🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.swing
3 messages
3 total messages Started by John T. Dow Fri, 26 Mar 2004 19:34
How to set width of JMenuItem on JMenuBar
#1103
Author: John T. Dow
Date: Fri, 26 Mar 2004 19:34
15 lines
1438 bytes
I posted this to the ide group but have received no answer. It's 
possibly a swing question anyway.

I need a menu choice on the default menu bar which when selected doesn't 
cause a submenu to drop down but triggers its action immediately.

The problem I'm having when I put a jMenuItem (not a jMenu) on the menu 
bar is it is much wider than the other things on the bar, all of which 
are jMenu.

I don't see how to control the width of a jMenuItem on the bar.

What am I missing?

John
Re: How to set width of JMenuItem on JMenuBar
#1105
Author: John T. Dow
Date: Fri, 26 Mar 2004 20:16
37 lines
2375 bytes
pnichols wrote:
> John T. Dow wrote:
> 
> 
>>I posted this to the ide group but have received no answer. It's
>>possibly a swing question anyway.
>>
>>I need a menu choice on the default menu bar which when selected doesn't
>>cause a submenu to drop down but triggers its action immediately.
>>
>>The problem I'm having when I put a jMenuItem (not a jMenu) on the menu
>>bar is it is much wider than the other things on the bar, all of which
>>are jMenu.
>>
>>I don't see how to control the width of a jMenuItem on the bar.
>>
>>What am I missing?
>>
>>John
> 
> 
> It should auto-adjust to the font and text you are using.

No, it's much wider than it should be. (Following the text is a lot of 
empty space, all of which can be clicked with the mouse to trigger the 
action.)

I suspected that the menu item is looking at everything else on the bar 
and making itself just as wide as the widest (because menu items should 
be on menus, one above another), but that's not the case. It's much 
wider than any of the other menus on the bar.

Although it doesn't look good, it does what I want. Namely, click on it 
and the action is performed.

Perhaps another approach is to add a menu and then override its action, 
which is to do a popup menu.
Re: How to set width of JMenuItem on JMenuBar
#1104
Author: pnichols
Date: Fri, 26 Mar 2004 20:20
19 lines
1550 bytes
John T. Dow wrote:

> I posted this to the ide group but have received no answer. It's
> possibly a swing question anyway.
> 
> I need a menu choice on the default menu bar which when selected doesn't
> cause a submenu to drop down but triggers its action immediately.
> 
> The problem I'm having when I put a jMenuItem (not a jMenu) on the menu
> bar is it is much wider than the other things on the bar, all of which
> are jMenu.
> 
> I don't see how to control the width of a jMenuItem on the bar.
> 
> What am I missing?
> 
> John

It should auto-adjust to the font and text you are using.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads