추가 질문 to my other one;JSplitPane + MiGLayout : 비례 자동 크기 조정을 사용하는 방법
비례 크기 조정을 사용하려면 어떻게해야합니까? 나는이 일 것이라고 생각하지만 그렇지 않습니다 :
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import net.miginfocom.swing.MigLayout;
public class SplitPaneQuestion {
public static void main(String[] args) {
JFrame frame = new JFrame("SplitPaneQuestion");
JPanel panel = new JPanel();
frame.setContentPane(panel);
panel.setLayout(new MigLayout("","[]","[grow]"));
JSplitPane splitpane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
panel.add(splitpane, "push, grow");
splitpane.setTopComponent(new JButton("top"));
splitpane.setBottomComponent(new JButton("bottom"));
splitpane.setDividerLocation(0.333);
frame.pack();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
나는 전체 프레임 크기를 조정할 때 내가하고 싶은 위/아래 버튼 크기의 비율입니다 것은 일정합니다. (기본적으로 1 : 2 비율로)
어떻게해야합니까?
아하! 고마워, 나는 setDividerLocation가 작동 할 것으로 기대하고 있었고, 그 때 내가 무엇을 해야할지 전혀 몰랐다. –