728x90
반응형
GUI기반 Gridlayout 가장 기본적인 소스코드
Gridlayout
import java.awt.*;
import javax.swing.*;
public class GridlayoutTest extends JFrame{
Button b1,b2,b3,b4,b5;
GridlayoutTest(){
b1=new Button("1"); b2=new Button("2");
b3=new Button("3"); b4=new Button("4");
b5=new Button("5");
this.setLayout(new GridLayout(2,3));
this.add(b1); this.add(b2);
this.add(b3); this.add(b4);
this.add(b5);
this.setDefaultCloseOperation(3);
this.pack(); this.setVisible(true);
}
public static void main(String[] args) {
new GridlayoutTest();
}
}
728x90
반응형