Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.robin;
- import me.jframe.JFrame;
- import java.util.Random;
- import java.util.Timer;
- import java.util.TimerTask;
- public class Main {
- private String lastAction="";
- private JFrame frame;
- private javax.swing.JFrame jframe;
- public static Main instance;
- public static void main(String[] args){
- new Timer().schedule(new TimerTask() {
- @Override
- public void run() {
- instance=new Main();
- instance.jframe=new javax.swing.JFrame();
- instance.frame=new JFrame(instance.jframe);
- }
- },200);
- }
- private String getAction(){
- Random r =new Random();
- Integer i = r.nextInt(4);
- String action = "";
- if (i==0){
- action="Schere";
- }else if (i==1){
- action="Stein";
- }else if (i==2){
- action="Papier";
- }else if (i==3){
- action="Echse";
- }else if (i==4) {
- action="Spock";
- }
- if (lastAction.equalsIgnoreCase(action)){
- action=getAction();
- lastAction=action;
- return action;
- }
- lastAction=action;
- return action;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement