- 浏览: 15844 次
- 性别:
- 来自: 西安
最新评论
文章列表
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.List;
/*问题是,往F:\\java\\Append.txt文本中的第3行的数字后面加入AAA,用java解决
不能把东西输出到别的地方,只能是在F:\\java\\Append.txt里改动。
/*注 ...
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class FileCopy {
public void copy(String fristPath, String secondPath) {
File file1 = new File(fristPath);// 实例化File
...
public class MakeGirlfriend implements Runnable{
private int flag = 1; //flag = 1,代表:1号帅哥。flag = 2,代表:2好帅哥
static Object o1 = new Object(),o2 = new Object();
//这里的意思是o1代表:1号美女,o2代表 ...
public class ProduserandConsucer {
public static void main(String[] args) {
Stack sk = new Stack();
Producer p = new Producer(sk);
Cunsumer c = new Cunsumer(sk);
new Thread(p).start();
new Thread(c).start();
}
}
class WoTou{
int id;
...
正常情况下必须先有类,再有对象,反射是:通过对象,找到其所在的类。
● 实例化Class的三种方法:
1.getClass()
public static void main(String[] args) {
Person p = new Person();
Class<?> c = p.getClass();//取得Class对象
System.out.println(c.getName());
}
...
Class<>:
1.取得Class对象:public static Class<?> forName(String className)
2.取得类中的所有构造方法:public Constructor<?>[] getConstructors()
3.实例化对象的方法:public T newInstance()
4.取得继承的父类:public Class<? super T> getSuperclass()
5.取得实现的全部接口:public Class< ...
windowbuilder,也就是原来的SWT Designer。Google收购了Instantiations,把它的工具也重新免费发布了。用过swt designer的人都知它是非常好用的swing/swt可视化开发工具,有了它,swing/swt也可以像visual studio一样拖拉控件写程序(虽然netbean也可以,不过没怎用),可惜是个收费产品,后来把改名为windowbuilder。不过Google把这个工具的开发公司Instantiations收购了,并把这个产品免费发布。Google收购Instantiations是为了给它的GWT设计开发工具,据说也是为了它的Anroid ...
直接放在main前面即可
try {for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {if ("Nimbus".equals(info.getName())) {UIManager.setLookAndFeel(info.getClassName());break;}}} catch (Exception e) {JOptionPane.showMessageDialog(null, "未找到新皮肤,请升级JDK到6.0 update 10");}
import javax.swing.*;import java.awt.*;import java.awt.event.*;
public class DaYin {
static Point origin = new Point(); //全局的位置变量,用于表示鼠标在窗口上的位置 static JFrame myFrame = new JFrame(); JLabel QD = new JLabel("消费清单"); DaYin(){ myFrame.getContentPane(). ...
在使用JFrame.setBackground(new Color);是发现这个方法调用后并没有改变JFrame窗口的背景颜色,这体现了点JFrame和Frame的区别:JFrame要用:JFrame.getContentPane().setBackground(new Color);来改变JFrame的背景颜色;Frame中则可以直接使用:Frame.setBackground(new Color);
JFrame透明度设置
java.awt.EventQueue.invokeLater(new Runnable() { public void run() { AAA ...