• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

radio buttons being non focusable

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Andrew
Try using setEnabled(false) instead...
 
Marshal
Posts: 80764
488
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic