1
그래서 GroupLayout 및 3 구성 요소가있는 기본 프레임이 있습니다. 이론은 그
Swing GroupLayout은 하나의 구성 요소 만 표시합니까? 그것을 고치는 방법?
[------ 라벨 ------]
은 [버튼] [버튼]
그러나 그것은 나를만을 보여줍니다 처럼 보일 것이다 마지막으로 사용한 버튼 구성 요소 (버튼 "bJeden"은 전체 창에 맞게 펼쳐짐). 내 코드는 프로그래머 :
프레임 파일 :
public class MainFrame extends JFrame{
GroupLayout layout = new GroupLayout(getContentPane());
JButton bZero = new JButton("0");
JButton bJeden = new JButton("1");
JLabel label = new JLabel("LABEL");
MainFrame(){
this.setBounds(200, 200, 640, 480);
layout.setHorizontalGroup(layout.createSequentialGroup()
.addComponent(label)
.addGroup(layout.createSequentialGroup()
.addComponent(bZero)
.addComponent(bJeden)
)
);
this.setVisible(true);
}
}
주요 파일 :
public class Main {
public static void main(String[] args) {
MainFrame mf = new MainFrame();
}
}
어떻게 그 문제를 해결하기 위해?
나는 "위치 pcg.MainFrame을 상징 var에 getCon을 ... 찾을 수 없습니다", 컴파일러는 getContentPane을 강조하고 던졌습니다 추가 – Betewu
의 레이아웃을 설정하지 오타가 있습니다 (괄호가 빠짐). 수정했습니다. – objects
모든 것이 잘 작동합니다. 덕분에 많이 – Betewu