Mac OS X でスクリーン メニュー バーに移動するJMenuBar
と、ウィンドウ内でメニューが表示される場所に空白のスペースが残ります。そのスペースを削除する必要があります。私は使っている
System.setProperty("apple.laf.useScreenMenuBar", "true")
JMenuBar
画面のメニューバーに移動します。Mac を使用している私の友人は、私がそのプロパティを設定しなかった場合、メニューが存在する場所に醜い垂直スペースが残ると報告しています。この問題を解決する最善の方法は何ですか?
編集:これは私の情報源からの例です:
public static void main(String[] args) {
System.setProperty("apple.laf.useScreenMenuBar", "true");
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Name");
JFrame frame = new JFrame("Gabby");
final DesktopMain dm = new DesktopMain();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(dm);
frame.setSize(160, 144);
frame.setLocationRelativeTo(null);
frame.setIgnoreRepaint(true);
JMenuBar menuBar = new JMenuBar();
JMenu fileMenu = new JMenu("File");
menuBar.add(fileMenu);
// Populating the menu bar code goes here
frame.setJMenuBar(menuBar);
frame.setVisible(true);
}