-1
OSX에서 NetBeans 8.2를 사용하고 있고 코드를 실행할 때 적절한 제목이있는 창이 나타나지만 구성 요소가 나타나지 않습니다. 모든 프레임이 표시되도록 설정했으나 여전히 문제가 지속됩니다.JFrame 누락 된 내용 패널이있는 GridBagLayout
public Project(){
setTitle("Panel");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(400, 200);
setLocationRelativeTo(null);
setLayout(new GridBagLayout());
setVisible(true);
GridBagConstraints layout = new GridBagConstraints();
layout.gridy = 3;
JPanel topPanel = new JPanel();
topPanel.setVisible(true);
topPanel.setLayout(new GridLayout(2,1));
topPanel.add(label1);
topPanel.add(textField1);
JPanel midPanel = new JPanel();
midPanel.setVisible(true);
midPanel.setLayout(new GridLayout(1,1));
midPanel.add(button1);
JPanel bottomPanel = new JPanel();
bottomPanel.setVisible(true);
bottomPanel.setLayout(new GridLayout(2,1));
bottomPanel.add(label2);
bottomPanel.add(textField2);
add(topPanel);
add(midPanel);
add(bottomPanel);
}
public static void main(String[] args) {
Project1 frame = new Project1();
}