Relative Content

Tag Archive for javajframeactionlistener

i am making a code that when button is pressed it will change the button to a color(yellow or red) but i cant make it to detect a button press in JAVA

Turn Turnes = new Turn(){ while(Turnes.getplays[] < 9){ if(%Turnes.getplays[i] = 0){ Turnes.setcolor() = “red” } else{ continue } if(Turnes.getcolor = “red”){ if(%Turnes.getplays[i] != 0){ Turnes.setcolor = “yellow” } else{ continue } }} jButton1.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent Turnes.setplays[] += 1) if(Turnes.getcolor = “red”){ jButton1.setBackground(Color.RED) } else{ if(Turnes.getcolor = “yellow”){ jButton1.setBackground(Color.YELLOW)) } }); } as i […]