[問題] BorderLayout on GridLayout
想要做一個程式如下
1
2 3 4
5
6 7
8 9
10 11
12 13
每個數字都是一個Button
而且在拉視窗的時候 上面的GridLayout 下面的BorderLayout會一起變大變小
也就是Frame是一個2X1的Grid
然後在Frame第一列內放入BorderLayout
第二列放入GridLayout這樣
但想不出來 程式碼要怎麼寫 才能把Border放在底下的Grid裡面
有人能解答嗎~?
補充:
我想出來的程式碼= =
import java.awt.*;
import java.awt.event.*;
public class GridLayoutDemo extends java.awt.Frame {
public static void main(String args[]){
new GridLayoutDemo();
}
public GridLayoutDemo() {
super("Grid Layout Demo");
final int row = 2;
final int column = 1;
setLayout(new GridLayout(row, column));
Button button1 = new Button("EAST");
Button button2 = new Button("SOUTH");
Button button3 = new Button("WEST");
Button button4 = new Button("NORTH");
Button button5 = new Button("CENTER");
this.setSize(480, 720);
this.setVisible(true);
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.135.230.54
推
06/24 20:41, , 1F
06/24 20:41, 1F
※ 編輯: jimhu 來自: 220.135.230.54 (06/24 20:52)
→
06/24 20:53, , 2F
06/24 20:53, 2F
→
06/24 21:33, , 3F
06/24 21:33, 3F