how to fire ItemStateChanged event

W

Wizumwalt

Is there anyway for me to programatically fire an ItemStateChanged
ItemEvent on a class w/ ItemListener? Basically, I need to select a
certain tab from my JTabbedPane when my actionPerformed() method from a
JTree is selected.

Any help much appreciated.
 
V

Vova Reznik

Is there anyway for me to programatically fire an ItemStateChanged
ItemEvent on a class w/ ItemListener? Basically, I need to select a
certain tab from my JTabbedPane when my actionPerformed() method from a

Why not just yourTabbedPane.setSelectedIndex(int index);
?
 
R

Roedy Green

Is there anyway for me to programatically fire an ItemStateChanged
ItemEvent on a class w/ ItemListener? Basically, I need to select a
certain tab from my JTabbedPane when my actionPerformed() method from a
JTree is selected.

The easiest way is to call the method with a fake Event.

The next easiest way is to construct a synthetic event and add it to
the queue. see http://mindprod.com/jgloss/events11.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top