order selected statement with JComboBox [closed]

1

Hi, I have a question, is there any way to do that if I select an article from some JComboBox, do some function? I mean, if I select article 1 that is printed on the screen, hello, that is, that kind of function, someone to help me please.

    
asked by PartyHard 11.08.2017 в 00:13
source

1 answer

1

Good I managed to do what I wanted but I have a question how can I make the selected value pick it up from my BD in mysql here I leave my code I mean in the equals part ("2") instead of verifying that the value is 2 that verifies that the value is that of some table in my database.

if (txtProducto.getSelectedItem().equals("2"))
    {
        JOptionPane.showMessageDialog(null, "Dos");
    } else {
        JOptionPane.showMessageDialog(null, "Este no es Dos");
    }
}
    
answered by 11.08.2017 в 00:59