Handling Swing Component Events

Description

Computer Programming (Java) Note on Handling Swing Component Events, created by desnunan on 29/03/2014.
desnunan
Note by desnunan, updated more than 1 year ago
desnunan
Created by desnunan over 10 years ago
43
0

Resource summary

Page 1

Find out whether or not JCheckBox is selectedpublic void itemStateChanged(ItemEvent ev) {        String onOrOff = "off";    if ( check.isSelected() ) onOrOff = "on";    System.out.println("Check box is " + onOrOff);}

Find out which thing in the list has been selectedpublic void valueChanged(ListSelectionEvent lse) {    if( !lse.getValueIsAdjusting() ) {                String selection = (String) list.getSelectedValue();        System.out.println(selection);    }}

JCheckBox

JList

Show full summary Hide full summary

Similar

Java Week 5 Object Oriented Programming
Troy Bowlin
Making a GUI
desnunan
Java Practice 1
Ummm No
PEGA CSSA Prep
Wendell Phipps
Getting a User Event
desnunan
Listener
desnunan
Paintable Widgets
desnunan
Playing with Swing Components
desnunan
Make a JScrollPane
desnunan
Java Practice 2
Ummm No
Servion - Java Questionnaire
rohit.benedict