Monday, 9 June 2014

Generate values form jList to jTextfield

First create a text field and list using your IDE.

Your have to select the proper event to code. Normally we select values from lists, so choose ListSelection - valueChanged event.

Convert list values to the String and get the string values from the jList.

String text = jList1.getSelectedValue().toString();

Now set above String values to the Text field.

jTextField1.setText(text);

code: 
private void jList1(javax.swing.event.ListSelectionEvent evt) {               String text = jList1.getSelectedValue().toString();
        jTextField1.setText(text);
    } 

Enjoy coding!...




No comments:

Post a Comment