This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes How to put menu item in Title bar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to put menu item in Title bar" Watch "How to put menu item in Title bar" New topic

How to put menu item in Title bar

Manoj Tyagi
Ranch Hand

Joined: Jun 11, 2002
Posts: 35
Dear All,

I have a problem with my GUI. Actually in Java generally we put menu & menu-items in menubar which is shown just below the Title bar ( in a JFrame )

But I want to put my Menu ( & further menu-item through pop-up or so) in Title bar so that I do not have to put the Menu-bar.

I am using swing version of Java GUI.....

Is there any way to do it.

Please help me out.........


Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299

This can't be done with pure Java. With JNI, anything is possible, but chances are you won't want to mess with that. I wouldn't want to.

Out of curiosity, why do you want a menu in the Title bar? This is something I have to say I have never seen.

GenRocket - Experts at Building Test Data
Manoj Tyagi
Ranch Hand

Joined: Jun 11, 2002
Posts: 35
Thanks Gregg,

I agree with you , it may make a mess. But actually I was simulating a GUI which was made in C++ (may be) & it was having Menu (Items) in Title bar.

Moreover, what happened with me. I have completed my whole GUI & in most of the cases I have used Null Layout. Initially there was no need for Menu options like File>Save, Help>About etc.

But now in the end there is a need for all this. I have no space to do it & also I do not what to disturb Null layout. Only space seems to be in Title bar only.

Thats why this idea came. Any way thanks for your suggestions....

Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 30057

The menubar is separate from the rest of the layout, so it won't mess up the flow. It does take up space, so there is little you can do there.

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
It is sorta covered in the JavaRanch Style Guide.
subject: How to put menu item in Title bar
Similar Threads
Popup menu for look and feel
How to link JComboBox item with a webpage
B&S 2.2.1 : Short cut keys & Menu in GUI
Rate My GUI