Key « JList « Java Swing Q&A





1. How can I add the keys of a LinkedHashMap to a JList?    stackoverflow.com

I have a LinkedHashMap<String,Object> and was wondering what the most efficient way to put the String portion of each element in the LinkedHashMap into a JList.

2. Select Multiple Items In JList Without Using The Ctrl/Command Key    stackoverflow.com

I am looking for a way to select multiple items within a JList by just clicking each item. The normal way to do this is to hold the command/ctrl key and then ...

3. Exception on deleting JList items on keypress    stackoverflow.com

I'm getting a NullPointerException in my JList, but the source of the exception seems to be the Swing event handling code. The JList has a key listener which will delete ...

6. JList enter key advice needed    coderanch.com

Hi, everybody! I have a jtextfield, every time F7 is pressed on this jtextfield i'm displaying a jlist. The user selects from that jlist by pressing ENTER key. To trap this event, I added a key listener to the jlist and once enter key is pressed, i'm processing the selected item and returning focus to the original jtextfield where F7 was ...

7. Arrow key to traverse items in JList    coderanch.com

something to play around with import java.awt.*; import java.awt.event.*; import javax.swing.*; class Testing extends JFrame { JRadioButton[] rb = new JRadioButton[4]; int rbSelection = 0; public Testing() { setLocation(400,300); setDefaultCloseOperation(EXIT_ON_CLOSE); JPanel jp = new JPanel(new GridLayout(4,1)); ButtonGroup group = new ButtonGroup(); for(int x = 0; x < rb.length; x++) { rb[x] = new JRadioButton("RB "+x); group.add(rb[x]); jp.add(rb[x]); rb[x].addKeyListener(new KeyAdapter(){ public void ...