Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package p3;
- //import java.awt.BorderLayout;
- import java.awt.Dimension;
- import java.awt.FlowLayout;
- //import java.awt.GridLayout;
- //import java.util.Random;
- import java.util.Random;
- import javax.swing.JLabel;
- //import javax.swing.JPanel;
- public class SSPViewer extends JLabel {
- private JLabel lblWin = new JLabel("Först till 3 vinner!");
- private JLabel lblHum = new JLabel("Human");
- private JLabel xxx = new JLabel(" ");
- private JLabel lblHumScore = new JLabel("0");
- private JLabel lblHumWep = new JLabel("vapen");
- private JLabel lblCump = new JLabel("Computer");
- private JLabel lblCumpScore = new JLabel("0");
- private JLabel lblCumpWep = new JLabel("Vapen");
- // public Object humanChoice;
- public static int STEN = 0, SAX = 1, PÅSE = 2;
- public SSPViewer() {
- setPreferredSize(new Dimension(200, 200));
- lblWin.setPreferredSize(new Dimension(200, 50));
- setLayout(new FlowLayout());
- add(lblWin);
- add(xxx);
- add(lblHum);
- add(lblHumScore);
- add(lblHumWep);
- add(lblCump);
- add(lblCumpScore);
- add(lblCumpWep);
- }
- public void setVapen(String vapen) {
- lblHumWep.setText(vapen);
- }
- public void setNbr(int sel) {
- Random random = new Random();
- int select = random.nextInt(3);
- if (select == 0) {
- System.out.println("0");
- lblCumpWep.setText("påse");
- } else if (select == 1) {
- System.out.println("1");
- lblCumpWep.setText("sax");
- } else if (select == 2) {
- System.out.println("2");
- lblCumpWep.setText("Sten");
- }
- }
- //
- // public void setChange(String string) {
- // System.out.println("wazzzaaappp");
- // lblCumpWep.setText("dddd");
- // System.out.println("broooor");
- // }
- }
- // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement