我在設置JMenuBar
的字體時遇到問題。我個人不喜歡用粗體字標出的Java框架默認情況下使用,所以我試圖用這樣的事情來改變它:更改JMenuBar的字體
public class MyFrame extends javax.swing.JFrame {
public MyFrame() {
JMenuBar menuBar = new JMenuBar();
menuBar.setFont(new Font("sans-serif", Font.PLAIN, 12));
setJMenuBar(menuBar);
setSize(600, 400);
// add some menus to the menu bar
menuBar.add(new JMenu("Foo"));
menuBar.add(new JMenu("Bar"));
menuBar.add(new JMenu("Baz"));
menuBar.add(new JMenu("Qux"));
setVisible(true);
}
}
據我知道,行menuBar.setFont(...)
設置由所使用的字體組件menuBar。但是當我實例化其中一個框架時,默認字體根本沒有改變,即使我將字體大小設置爲30.
我很感激任何關於此的幫助。
你嘗試改變字體每個JMenu的?你也可以更改uidefaults – nachokk 2014-12-05 14:34:39
@nachokk哦天哪。我是個白癡。謝謝。 – mezzodrinker 2014-12-05 14:35:38