Laptop test so I can work on both desktop and laptop & added some code for scissors
This commit is contained in:
parent
8e4b96f969
commit
f8a6411730
@ -19,11 +19,11 @@ public class Rock_paper {
|
|||||||
|
|
||||||
JButton rockbutton = new JButton("rock");
|
JButton rockbutton = new JButton("rock");
|
||||||
JButton paperbutton = new JButton("paper");
|
JButton paperbutton = new JButton("paper");
|
||||||
JButton sissorsButton = new JButton("scissors");
|
JButton scissorsbutton = new JButton("scissors");
|
||||||
JPanel panel = new JPanel();
|
JPanel panel = new JPanel();
|
||||||
panel.add(rockbutton);
|
panel.add(rockbutton);
|
||||||
panel.add(paperbutton);
|
panel.add(paperbutton);
|
||||||
panel.add(sissorsButton);
|
panel.add(scissorsbutton);
|
||||||
rockbutton.addActionListener(new ActionListener(){
|
rockbutton.addActionListener(new ActionListener(){
|
||||||
public void actionPerformed(ActionEvent e){
|
public void actionPerformed(ActionEvent e){
|
||||||
rock = true;
|
rock = true;
|
||||||
@ -47,6 +47,18 @@ public class Rock_paper {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
scissorsbutton.addActionListener(new ActionListener(){
|
||||||
|
public void actionPerformed(ActionEvent e){
|
||||||
|
scissors = true;
|
||||||
|
if(scissors == true) {
|
||||||
|
paper = false;
|
||||||
|
scissors = false;
|
||||||
|
System.out.println("paper is true");
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
frame.add(panel);
|
frame.add(panel);
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user