Solved

JComboBox event in an applet.

Posted on 2004-08-09
7
711 Views
Last Modified: 2012-05-05
Hmmm, I am using JBuilder X and I am trying to create an event for a JComboBox that is in a JTabbedPane in a JApplet.  It doesn't seem to be able to catch the event for the JComboBox.  I can make and catch events for my JListBox.  Is there a special procedure that I must call or can I create a different event?  I was trying to create a caretPositionChanged event, but it doesn't seem to want to work in the applet.  Any suggestions?  Thanks.

0
Comment
Question by:kesea
7 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 11750819
You will need to add an InputMethodListener to your JComboBox. Can you post some code?
0
 
LVL 9

Expert Comment

by:Nick_72
ID: 11750828
In design view for the applet in JBuilder, select the JComboBox. To the right you have a tab with the properties of the combo, and there is also a tab named 'Events'.
Select that tab, and doubleclick in the field named 'actionPerformed' (at the top) and JBuilder will create the neccessary code for you, and place the cursor where the event is caught.

Hope it helps,

/Nick
0
 
LVL 92

Expert Comment

by:objects
ID: 11750890
try adding your listener to the combobox editor.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 37

Accepted Solution

by:
zzynx earned 500 total points
ID: 11751498
>> I am trying to create an event for a JComboBox

yourComboBox.addActionListener( new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
           System.out.println("A new item is chosen in the combo box: " + yourComboBox.getModel().getSelectedItem() );
      }
});
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 11751830
Can you post code?
0
 
LVL 37

Expert Comment

by:zzynx
ID: 11754117
Thanks for accepting :°)
0
 
LVL 92

Expert Comment

by:objects
ID: 11758328
Isn't that what Nick_72 suggested?
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

773 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