Only 49 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JFileChooser.setApproveButtonMnemonic() doesn't work  RSS feed

 
Norbert Lebenthal
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

I'm displaying a JFileChooser this way


yet the Ok button's k isn't underlined and hitting alt + k doesn't trigger it...

what am I missing ?

thanks in advance
 
Tom Reilly
Rancher
Posts: 618
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like KeyEvent.VK_K refers to upper case 'K'. (It's value is 75 - the same as the ASCII code for 'K'). Try changing your code to: or
 
Rob Camick
Ranch Hand
Posts: 2752
11
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the following code in the MetalFileChooserUI class:

 
Norbert Lebenthal
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

A little boy after, I'm back (and mum at the hospital as it should be )

@Tom

I tried both, plus extra stuff, to no success.

I guess Rob finding explains it.

Anyway, I let the code setting the mnemonic, maybe some other L&F could make use of it.

a pity it doesn't work but it isn't such a big deal
 
Rob Camick
Ranch Hand
Posts: 2752
11
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try using a brute force method to set the mnemonic on the button with the help of Darryl's Swing Utils.

To access the button I guess the code would be:

 
Norbert Lebenthal
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not allowed to use SwingUtils in what I do, so... but good to know though.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!