Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How To handle events for a List  RSS feed

 
Conrad McLaughlin
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm new to java. not sure if this should be in beginners section.

How do you handle events for a list? If I have for example two items in a list and I want a system output for the item I have selected how do I do that?

This is part of the code that compiles and I see the list in Jframe:



How do I write code so it says "Message 1 selected" or "Message 2"?
Do I use Action events? How?
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the section "Selecting Items in a List" on the page How to Use Lists in the java swing tutorial.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!