How can I create title bar menu in Java

半城伤御伤魂 提交于 2019-12-13 06:30:01

问题


I wanna create a simple application with Java. I designed the main template in my head but I have a kind of design problem.

I am using JMenuBar and JMenu. It works fine but it's location is not exactly what I want.

In ubuntu, I use Eclipse and it has menu in titlebar:

As you can see , menus are at top.(File,Edit,Source,etc..)

However, My application is not the same.

Here is my application.

JMenu is working fine but in title bar there is no menu.

What can I do to create this menus ?

Are there any component for it ?

Thank you. Best Regards. Ömer.


回答1:


You may be interested by the Jayatana project




回答2:


You're using the right components, but have a Look and Feel (L&F) problem. Take a look here:

http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

however, I can't guarantee that changing the look and feel will make it look exactly as you want.


The general problem is that Swing abstracts away from the OS's GUI components. Eclipse is also Java, but SWT instead of Swing, so it doesn't have the problem. There may be third party libraries that integrate better with the native L&F - Maurice seems to have found one. Alternatively, you could switch to SWT entirely, but that might be a bit much just to get the right L&F.



来源:https://stackoverflow.com/questions/24108272/how-can-i-create-title-bar-menu-in-java

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!