How to use the JList Swing control on a form.
You can run this technique code from:
NOTE First make sure that database is running on your localhost SilverStream Server | |
See the chapter on the Form Designer in the Tools Guide |
The following code uses the getItemAt()
and getSelectedIndex()
methods to get the String value of a selected row in the JList listEmployees, then uses setText()
to display it in the text field fldRowText. Then the code uses getValue()
to get the row index value as a String and displays in fldRowValue.
This code is from the actionPerformed event of listEmplolyees:
// Get the display text value of the selected row and display // this in fldRowText fldRowText.setText((String) listEmployees.getItemAt(listEmployees.getSelectedIndex()). toString()); // Get the value and display it in fldRowValue fldRowValue.setText(((Integer) listEmployees.getValue()).toString());