0
我希望WEST
和EAST
佈局的分數是不變的寬度。如何設置MigLayout
?請舉個簡單的例子來說明如何用MigLayout模擬BorderLayout?
UPDATE
下面的代碼並不像調整邊界佈局:
package testing.Test_MigLayout_01;
import javax.swing.JButton;
import javax.swing.JRootPane;
import javax.swing.SwingUtilities;
import net.miginfocom.swing.MigLayout;
public class App201210042244
{
private class JFrame extends javax.swing.JFrame {
{
setLayout(new MigLayout());
add(new JButton("1"), "dock east, width 120");
add(new JButton("2"), "west");
add(new JButton("3"), "center");
add(new JButton("4"), "north");
add(new JButton("5"), "south");
}
}
public App201210042244() {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JFrame jFrame = new JFrame();
jFrame.pack();
jFrame.setVisible(true);
}
});
}
public static void main(String[] args)
{
new App201210042244();
}
}
窗口內部的大小保持不變:
這並不像調整'BorderLyout()',看到我更新。 –