import javax.swing.JButton;
import javax.swing.JFrame;
class Frame7 extends JFrame{
Frame7(){
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(200,200,450,300);
setTitle("Swing JFrame 視窗");
}
}
public class FrameJPanel {
public static void main(String[] args) {
Frame7 frame = new Frame7();
frame.setLayout(null);
JButton button1 = new JButton("button 1");
button1.setBounds(0,0,100,30);
frame.add(button1);
JButton button2 = new JButton("button 2");
button2.setBounds(0,50,100,30);
frame.add(button2);
JButton button3 = new JButton("button 3");
button3.setBounds(0,100,100,30);
frame.add(button3);
frame.setVisible(true);
}
}
執行結果
2014年4月16日 星期三
Swing:元件:JButton 不使用 JPanel
訂閱:
張貼留言 (Atom)

沒有留言:
張貼留言