JList selected item to String

后端 未结 4 2242
清酒与你
清酒与你 2021-02-19 15:10

Could someone tell me how to get the selected item of JList to a String? It is a single selection JList.

4条回答
  •  鱼传尺愫
    2021-02-19 15:29

    If you want the value of the selected item to a string you should try

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

提交回复
热议问题