세 번째 버튼의 크기를 다른 두 버튼과 같은 크기가되도록 조정하고 하단에 배치하는 방법에 대해 고민했습니다.JButton의 크기를 조정할 수 없습니다
class ControlFrame extends JFrame
implements Runnable
{
JButton jb_inc = new JButton();
JButton jb_zero = new JButton();
JButton jb_dec = new JButton();
ControlFrame() {
super("Control Frame");
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
ControlFrame(int x,int y, int w, int h) {
this();
this.setBounds(x, y, w, h);
this.setVisible(true);
jb_inc.setBounds(10,10,90,20);
jb_zero.setBounds(10,40,90,20);
jb_dec.setBounds(10,60,90,20);
jb_inc.setVisible(true);
jb_zero.setVisible(true);
jb_dec.setVisible(true);
this.getContentPane().add(jb_inc);
this.getContentPane().add(jb_zero);
this.getContentPane().add(jb_dec);
}
public void run() {
}
}
public class Counting_Machine
{
public static void main(String[] args) {
ControlFrame cf = new ControlFrame(0,200,80,150);
}
}
원래의 포스터가 묻는 문제를 해결하지만, 몇 가지 경우를 제외하고는 - '널 (null)'레이아웃을 사용하면 새로운 문제가 발생합니다. – Nate