Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

programmatically setting radio-button to selected is not firing the actionPerformed event

Posted on 2004-09-10
6
Medium Priority
?
548 Views
Last Modified: 2008-02-26
hello,

as question title suggests i want to programmatically select a radio-button, but i want it also to fire the radio-buttons actionListener event, how do i do this??
0
Comment
Question by:cathalmchale
  • 3
  • 2
6 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 12028531
You'll have to either call actionPerformed directly or post an event with EventQueue.postEvent(...)
0
 

Author Comment

by:cathalmchale
ID: 12028939
ah ok, no problem that works!!

is there a way of doing this:
the main frame has a tabbed pane - so each tab is a panel.  when a tab is clicked then panelMe becomes visible.
can panelMe listen for an event "when i become visible to the user then do something" ??
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 100 total points
ID: 12028988
Add a ChangeListener and then do that something if it's the right panel selected:

http://javaalmanac.com/egs/javax.swing/tabbed_TpEvt.html
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 92

Accepted Solution

by:
objects earned 100 total points
ID: 12031837
button.doClick();
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12064885
:-)
0
 
LVL 92

Expert Comment

by:objects
ID: 12071463
thanks mate :)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses
Course of the Month20 days, 15 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question