为了账号安全,请及时绑定邮箱和手机立即绑定

如何将JMenuBar移动到Mac OS X上的屏幕菜单栏?

如何将JMenuBar移动到Mac OS X上的屏幕菜单栏?

大话西游666 2019-08-05 15:48:19
如何将JMenuBar移动到Mac OS X上的屏幕菜单栏?当我将我移动JMenuBar到Mac OS X上的屏幕菜单栏时,它会留下一些空白区域,菜单将出现在我的窗口中; 我需要删除那个空间。我在用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);}
查看完整描述

3 回答

  • 3 回答
  • 0 关注
  • 604 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号