Source Code : Implement a graphical list selection monitor
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Implement a graphical list selection monitor

import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
public class SelectionMonitor extends JPanel {
String label[] = { "1", "2", "3"};
JCheckBox checks[] = new JCheckBox[label.length];
JList list = new JList(label);
public SelectionMonitor() {
JScrollPane pane = new JScrollPane(list);
add(pane);
list.addListSelectionListener(new RadioUpdater());
for (int i = 0; i < label.length; i++) {
checks[i] = new JCheckBox("Selection " + i);
add(checks[i]);
}
}
public static void main(String s[]) {
JFrame frame = new JFrame("Selection Monitor");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setContentPane(new SelectionMonitor());
frame.pack();
frame.setVisible(true);
}
}
class RadioUpdater implements ListSelectionListener {
public void valueChanged(ListSelectionEvent e) {
if ((!e.getValueIsAdjusting()) || (e.getFirstIndex() == -1))
return;
for (int i = e.getFirstIndex(); i <= e.getLastIndex(); i++) {
System.out.println(((JList) e.getSource()).isSelectedIndex(i));
}
}
}
Thank with us