Issue
Hi I am trying to make a popup window show when I click on an index of a jList. I am able to click on the items, but nothing happens. am I missing something? why isn't my jDialog opening? My code looks like this:
private void jList3ValueChanged(javax.swing.event.ListSelectionEvent evt) {
jList3.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
jList3.addListSelectionListener((ListSelectionEvent le) -> {
int idx = jList3.getSelectedIndex();
if (idx != -1){
jDialog5.setVisible(true);
jDialog5.setSize(430, 555);
}else{
jDialog6.setVisible(true);
jDialog6.setSize(430, 555);
}
});
}
Solution
You must add the action listener to the component
inx.addActionListener(this)
Answered By - Thelouras
Answer Checked By - David Goodson (JavaFixing Volunteer)