Hello
I have a small problem with ListSelectionListener.
I can not copy dataList.getSelectedValue().toString(); to global String variable text.
How can I do it ?
This is inside of if statement and that is the problem.
Anyone knows how to solve it ?
ListSelectionListener lListener = new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
dataList = (JList) e.getSource();
if(!(dataList.isSelectionEmpty())){
text = dataList.getSelectedValue().toString();
} else {
}
}
};
dataList.addListSelectionListener(lListener);