[英]Java multiple button size issue
I'm making a simple hobby piece that simply contains two buttons. 我正在做一个简单的爱好片,它只包含两个按钮。 When I try to set the size only one button, the work button, is set.
当我尝试设置大小只有一个按钮时,设置工作按钮。 This is true even if I comment out the play button code.
即使我注释掉播放按钮代码也是如此。
Here is the button creation code: 这是按钮创建代码:
Container content = frame.getContentPane();
JButton workBtn = new JButton("Work");
JButton playBtn = new JButton("Play");
workBtn.setSize(100, 100);
playBtn.setSize(100, 100);
workBtn.setVisible(true);
playBtn.setVisible(true);
content.add(workBtn);
content.add(playBtn);
I'm guessing it's something simple but I just can't see what or find that out. 我猜这是简单的事情,但我无法看到或发现了什么。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.