Solved

JComboBox event in an applet.

Posted on 2004-08-09
7
724 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
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!

 
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

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…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

623 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