0
因此,我在我写的Java程序中有几个JButton,它显然包含一个值(如在按钮上出现的文本中)。JButton的值总是适合Windows中的按钮,但不适用于Linux
当我在Windows中运行应用程序时,这个文本总是适合在JButton中 - 无论窗口有多小(我为该窗口设置了最小尺寸)。但是,当我在Linux中运行应用程序时,文本似乎不适合按钮。
我定义我的Jbutton将是这样的:
public class ButtonPanel extends JPanel {
private JButton undoButton;
/**
* Button panel constructor.
*/
public ButtonPanel() {
// Set the layout
this.setLayout(new FlowLayout(FlowLayout.CENTER, 10, 5));
// Add all buttons and register their listeners
undoButton = new JButton("Undo");
undoButton.setPreferredSize(new Dimension(100, 50));
undoButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("Undo button pressed");
try {
App.performActivity(Activity.UNDO);
} catch (Exception e1) {
e1.printStackTrace();
}
}
});
this.add(undoButton);
}
有没有人有什么想法?
谢谢
卡勒姆
绝对正确!非常感谢。 – Callum