I need to display an integer onto JLabel
, the following code does not work out well, even with Integer.parse()
.
How do I rectify it?
JLabel lblTemp = new JLabel("");
lblTemp.setBounds(338, 26, 46, 14);
contentPane.add(lblTemp);
//store int value of item clicked @ JList
int temp = list.getSelectedIndex() + 1;
lblTemp.setText(temp); // <- problem