Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mnemonic to Button in Windows look and feel

 
Karthick Dharani Vidhya
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Brian Cole
Author
Ranch Hand
Posts: 903
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For Windows look and feel, you need to press Alt first to see the underlined letter. It's different form Metal look and feel.
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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......'
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic