UseGridBag1(LAB7)
import javax.swing.*;
import java.awt.*;
class UseGridBag1 extends JFrame{
public UseGridBag1(String title){
super(title);
GridBagLayout gb=new GridBagLayout();
GridBagConstraints gc=new GridBagConstraints();
Container c=getContentPane();
c.setLayout(gb);
c.add(new JButton("Button1"),gc);
c.add(new JButton("Button2"),gc);
c.add(new JButton("Button3"),gc);
}
public static void main(String[]args){
UseGridBag1 f=new UseGridBag1("Use GridBag1");
f.setDefaultCloseOperation(f.EXIT_ON_CLOSE);
f.pack();
f.show();
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น