Solved

JComboBox event in an applet.

Posted on 2004-08-09
7
719 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
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.

 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jboss wildfly 10.1 10 623
Setup GlassFish 4 56
dao vs facade design patterns 2 75
DTD and JAVA versions 1 59
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 had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
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.

752 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