大学JAVA实验五
大学JAVA实验五
这一次的实验做的不满意,恳请各位批评,恳请各位提供方法及建议
第一个实验
指定不同协议的URL地址,获得资源文件的内容和属性
URLStudy.java
package first;
import java.awt.FileDialog;
import java.awt.Font;
import java.awt.TextArea;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class URLStudy extends JFrame {
private static final long serialVersionUID = 1L;
private Font font = new Font("宋体", Font.CENTER_BASELINE, 13);
TextArea textarea = new TextArea();
JButton button[] = new JButton[3];
String buttonName[] = { "确定", "取消", "保存文件" };
JLabel label = new JLabel("请输入URL地址:");
JTextField urlfield = new JTextField(20);
JPanel panel = new JPanel();
URLStudyListener listener = new URLStudyListener(this);
private String file = "";
private FileDialog filesave;
public URLStudy() {
super.setTitle("资源文件的内容和属性查看器");
ImageIcon icon = new ImageIcon("195032.jpg");//在当前目录下加入名为195032.jpg的图片即可改变窗口左上角的咖啡图片,不愿意改就注释这行与下一行
setIconImage(icon.getImage());
textarea.setFont(font);
label.setFont(font);
urlfield.setFont(font);
panel.add(label);
panel.add(urlfield);
for (int i = 0; i < buttonName.length; i++) {
button[i] = new JButton(buttonName[i]);
button[i].addActionListener(listener);
button[i].setFont(font);
panel.add(button[i]);
}
super.setDefaultCloseOperation(EXIT_ON_CLOSE);
&
相关文档:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class BubbleSort {
private static int a[] = new int[12];
private static BufferedReader in = new BufferedReader(
new InputStreamReader(System.in));
public static void bubbleSort(int a[], i ......
java 循环打印出某对象所在类的类名和方法
public class A {
public void b(){}
public void c(){}
public void d(){}
public void e(){}
}
import java.lang.reflect.*;
public class StaticTest {
public static void test(Object obj)
{
Class myclass = obj.getClass();
//System.out.prin ......
java 四种遍历List的方法及比较
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class ListTest {
public static void main(String args[]){
List<Long> lists = new ArrayList<Long>();
for(Long i=0l;i<1000000l;i++){
......
JAVA\JSP上传组件
本人只有这个水准,会的请指点,不会的,可以拿源码
大概的要求:
单独负责上传的类,只用iframe调用其它的类不用调用
上传预览
单个文件上传与多个文件都支付
多个文件上传需要在iframe父级页面传参,也就是开关鸟
预览时可以删除原文件和预览的(多个文件)某个节点
文件类型的在iframe定义
禁止用 ......
昨天,我的朋友请教我正则表达式。我也好久没有写过正则表达式了,昨天刚好看了下如鹏网创始人杨中科老师关于正则表达式的讲解。使我加深了正则表达式的印像。现我把他总结下:
许多语言,包括Perl、PHP、Python、JavaScript和JScript,都支持用正则 ......