Solved

JComboBox event in an applet.

Posted on 2004-08-09
7
708 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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:mayankeagle
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
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 learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

758 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now