• Post Reply Bookmark Topic Watch Topic
  • New Topic

radio buttons being non focusable

 
Andrew Brown
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?
 
samir Sadiki
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Andrew
Try using setEnabled(false) instead...
 
Campbell Ritchie
Marshal
Posts: 52516
118
  • 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.
 
Michael Dunn
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!