you already save it in izaberi variable, all you need to do is to display it. try:
JOptionPane.showMessageDialog(null, "Your choice was: "+(izaberi+1));
below your int izaberi...
Question
JAVA How to get Value from Optional Dialogue BOX
HELLO, i need help since am stack =D with this problem i made little program and now i made little option dialoge box with few options i want to save option u choose as Int how could i do that and here is the code:
final JButton btnOdaberi = new JButton("Odaberi");
btnOdaberi.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
int t = 0;
String[] rate = {"1","2","3","4","5","6","7","8","9","10","11","12"};
int izaberi = JOptionPane.showOptionDialog(btnOdaberi, "Izaberi broj rata", "Rate",0,t,null, rate,"1");
}
Thanks in advance.
Solution
you already save it in izaberi variable, all you need to do is to display it. try:
JOptionPane.showMessageDialog(null, "Your choice was: "+(izaberi+1));
below your int izaberi...