- import javax.swing.JButton;
- import javax.swing.JFrame;
- public class Ch76 {
- public static void main(String[] args) {
- JButton bn1=new JButton("button1");
- bn1.setBounds(10, 10, 220, 70);
- bn1.setEnabled(false);
-
- JButton bn2=new JButton("button2");
- bn2.setBounds(10, 90, 220, 70);
-
- JFrame fm=new JFrame("Button");
- fm.setBounds(100, 100, 250, 200);
- fm.setVisible(true);
- fm.setResizable(false);
- fm.setLayout(null);
- fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- fm.add(bn1);
- fm.add(bn2);
- }
- }
複製代碼 |