package 窗口;
import java.awt.*;
import javax.swing.*;
public class Window2 extends JFrame{
private Container cp;
private JButton jb;
public Window2(){
setSize(300,200);
setLocation(100,100);
setLayout(null);
setBackground(Color.lightGray );
setForeground(Color.orange );
cp=this.getContentPane();
init();
}
public void init(){
jb=new JButton("单击我");
jb.setBounds(100,80,200,40);
jb.setForeground(Color.CYAN );
jb.setFont(new Font("黑体",Font.BOLD ,20));
cp.add(jb);
}
public static void main(String[] args){
new Window2().setVisible(true);
}
}
一瞬儿光
相关分类