aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Mnemonic to Button in Windows look and feel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Mnemonic to Button in Windows look and feel" Watch "Mnemonic to Button in Windows look and feel" New topic
Author

Mnemonic to Button in Windows look and feel

Karthick Dharani Vidhya
Ranch Hand

Joined: Feb 23, 2008
Posts: 89
Hi,

I have a swing application. The look and feel for that application is WINDOWS LOOK AND FEEL. I have a JButton in it. When i try to set the mnemonic for that button, I am not getting the '-' icon below that particular letter in the button Name.

JButton button = new JButton("OK");
button.setMnemonic('O');

Same code works if i just change the look and feel to defalt java look and feel.


Karthick D V
Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 862
Originally posted by Karthick Dharani Vidhya:
I have a swing application. The look and feel for that application is WINDOWS LOOK AND FEEL. I have a JButton in it. When i try to set the mnemonic for that button, I am not getting the '-' icon below that particular letter in the button Name.

JButton button = new JButton("OK");
button.setMnemonic('O');

Same code works if i just change the look and feel to defalt java look and feel.


I don't pay attention to windows operating system all that often, but I just opened the winXP control panels and looked at all the buttons. None of them had any letters underlined. Do you see any native windows buttons with underlined letters? If not I would guess the windows LnF is simply emulating the native windows operating system in this regard.
[ April 17, 2008: Message edited by: Brian Cole ]

bitguru blog
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

For Windows look and feel, you need to press Alt first to see the underlined letter. It's different form Metal look and feel.


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19696
    
  20

From another topic:
Originally posted by Michael Dunn:
if xp, the default for mnemonics is 'hidden' (I think)

control panel/display/appearance/effects
and uncheck 'Hide underlined letters......'


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mnemonic to Button in Windows look and feel