Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
作为对最近的slashdot 帖子的回应,我决定添加一个选项,让菜单出现在左侧,这样打开时就不会遮挡整个应用程序。只是为了用户方便,有没有办法强制 jdesktop 上的 jmenu 位于左侧或右侧,即垂直菜单?
没有简单的方法可以做到这一点。
您最好的选择是使用 aBorderLayout并将 the 放置JMenuBar在BorderLayout.WESTorBorderLayout.EAST位置。但是,您将不得不花一些时间对其进行自定义以使其看起来不错。例如,如何让菜单垂直绘制菜单项,或者右侧的菜单是否会在应用程序上以正确的方向飞出,目前还不是很明显。
BorderLayout
JMenuBar
BorderLayout.WEST
BorderLayout.EAST