我想要一个 jframe,左边有文字(JLabel),右边有按钮。我首先添加了文本,并希望尽量不要将框架设置为从右到左。
EndFrame 代码 ... 使用来自其他类的信息,其他类更新 JLabel。
public class endFrame extends JFrame
{
public endFrame()
{
setSize(500,75);
setLayout(new FlowLayout());
add(board.winner);
JButton r = new JButton("Reset");
r.addActionListener(board.mouse);
add(r);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
}
}
MadProgrammer 向我展示了使用 Container#add(Comonent, int) 可以让您以所需的正确顺序移动对象。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句