|
@ -21,6 +21,9 @@ public class MouseGame extends JFrame { |
|
|
private JPanel contentPane; |
|
|
private JPanel contentPane; |
|
|
public Robot robot = new Robot(); |
|
|
public Robot robot = new Robot(); |
|
|
|
|
|
|
|
|
|
|
|
int resetX = 200; |
|
|
|
|
|
int resetY = 170; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Launch the application. |
|
|
* Launch the application. |
|
@ -43,9 +46,9 @@ public class MouseGame extends JFrame { |
|
|
public MouseGame() throws AWTException { |
|
|
public MouseGame() throws AWTException { |
|
|
|
|
|
|
|
|
//Fensterrahmen Haupt Layout |
|
|
//Fensterrahmen Haupt Layout |
|
|
setTitle("Maze Game"); |
|
|
|
|
|
|
|
|
setTitle("Mouse Game"); |
|
|
setBounds(100, 100, 900, 650); |
|
|
setBounds(100, 100, 900, 650); |
|
|
robot.mouseMove(200, 170); |
|
|
|
|
|
|
|
|
robot.mouseMove(resetX, resetY); |
|
|
|
|
|
|
|
|
contentPane = new JPanel(); |
|
|
contentPane = new JPanel(); |
|
|
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); |
|
|
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); |
|
@ -119,16 +122,26 @@ public class MouseGame extends JFrame { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}//end standardkonstruktor |
|
|
}//end standardkonstruktor |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getResetX() { |
|
|
|
|
|
return resetX; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getResetY() { |
|
|
|
|
|
return resetY; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void reset(JPanel panel) { |
|
|
private void reset(JPanel panel) { |
|
|
panel.addMouseListener(new MouseAdapter() { |
|
|
panel.addMouseListener(new MouseAdapter() { |
|
|
@Override |
|
|
@Override |
|
|
public void mouseEntered(MouseEvent e) { |
|
|
public void mouseEntered(MouseEvent e) { |
|
|
robot.mouseMove(200, 170); |
|
|
|
|
|
|
|
|
robot.mouseMove(resetX, resetY); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}//end class |
|
|
}//end class |