?
Solved

awt.List ItemEvent source...

Posted on 2003-02-28
4
Medium Priority
?
214 Views
Last Modified: 2010-07-27
This is for the awt.List:

I want to do things accodring to which item(s) is selected in a List. So I want to mark the selected items in a simple way, and then use that info when a button is pressed for example.

The ItemListener though that I put, receives ItemEvent-s coming from the List itself, not the items in the list. The only way I can see the actual items of the list, is the ItemEvent.paramString(), which is far from useful.

Is there a reasonable way to do it?? (To get the index number of the list item selected/pressed)

0
Comment
Question by:piou
[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
  • 3
4 Comments
 
LVL 92

Accepted Solution

by:
objects earned 480 total points
ID: 8046396
int index = list.getSelectedIndex();
String item = list.getSelectedItem();
0
 
LVL 92

Expert Comment

by:objects
ID: 8046400
The ItemEvent also contains details about the event.
0
 

Author Comment

by:piou
ID: 8046410
Damn I'm bad! Damn you're good! :) Why didn't I care to look at the List methods??? :)
0
 
LVL 92

Expert Comment

by:objects
ID: 8046439
Javadoc is your friend :-)
0

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

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

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month15 days, 2 hours left to enroll

771 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