Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

radio buttons being non focusable

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i need to know how set a radio button to be non-focusable.

i have tried radioButton.setFocusable(false);

but this does not work.

Any ideas?
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Andrew
Try using setEnabled(false) instead...
 
Marshal
Posts: 70625
288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a setFocusable() method in Component. Does that actually do what you want?

There is aJava Tutorial section about focus, and this website has the Java focus system specification in.

If radioButton.setFocusable(false); doesn't work, is it really the focus you are looking for?

CR
 
Andrew Brown
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a panel in a main content pane, it contains three radio buttons and takes the focus away from the content pain of the main applet when the radio buttons are pressed. I need to keep the focus on the applets content pane in order to allow the animations i have going on to still be activated by the key listeners.

Set focusable(false); has worked really well for all of the other buttons and textfields i have used, and i have tried setting the panels that the radio buttons are on as false, but alas, no joy.

The radio buttons are also in another class which complicates matters slightly.

Thanks for your continued help

Keep posting.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you have a listener attached to the radioButtons, include in the code (at end of?)
panel.requestFocusInWindow();

if you have no listener, add a focusListener and in focus gained, add the above line
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic