I wanna say excuse me first for my lack english. I am not a native speaker.
So, I am creating a rock scissor paper game with GUI in Java.
The algorithm is very simple. I will get a showOptionDialog with three buttons. (rock, scissor, paper) When I click one of the three buttons, Java will compare my choice and computer's choice. Computer will choose random number between 1~3
I am almost finished with my GUI but I have some problem with showOptionDialog
private String[]a = {"Rock","Paper","Scissor"};
private int userChoice;
/* some codes
*/
public void actionPerformed(ActionEvent e){
if(e.getSource()==play){
userChoice = JOptionPane.showOptionDialog(null,"Rock Paper Scissor","Choose",JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE,null,a,a[1]);
if(userChoice==a[0] )
}
}
I tried something like this but as you know java shows me an incomporable types int and String. Any good idea how should I do?