getSelectedValue « JList « Java Swing Q&A





1. Java - jList getSelectedValue problem    stackoverflow.com

I am trying to convert an object (selected item on jList1) to a string but it is returning null. I have tried:

Object object1 = jList1.getSelectedValue();
String string1 = object.toString();
&
String string1 = jList1.getSelectedValue().toString();
But they ...

2. jList Issues - getSelectedValue() Keeps returning "null"    java-forums.org

Java Code: private void jList1ValueChanged(javax.swing.event.ListSelectionEvent evt) { System.out.println(jList1.getSelectedValue()); } I'm trying to make it possible to select a name from a jList and for that name to be used to look up a corresponding profile using a string generated by getSelectedValue(). This is simply a test to make sure that it's picking up the value. However, every time I click a ...