Browse Source

refactoring: [MouseGame Class]: Auslagern der X-Variable des Resets.

remotes/origin/MouseGame
fdai7382 2 years ago
parent
commit
d0d0eb69e1
  1. 6
      JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java

6
JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/MouseGame.java

@ -21,6 +21,8 @@ public class MouseGame extends JFrame {
private JPanel contentPane; private JPanel contentPane;
public Robot robot = new Robot(); public Robot robot = new Robot();
int resetX = 200;
/** /**
* Launch the application. * Launch the application.
@ -45,7 +47,7 @@ public class MouseGame extends JFrame {
//Fensterrahmen Haupt Layout //Fensterrahmen Haupt Layout
setTitle("Mouse Game"); setTitle("Mouse Game");
setBounds(100, 100, 900, 650); setBounds(100, 100, 900, 650);
robot.mouseMove(200, 170);
robot.mouseMove(resetX, 170);
contentPane = new JPanel(); contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
@ -127,7 +129,7 @@ public class MouseGame extends JFrame {
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, 170);
} }
}); });
} }

Loading…
Cancel
Save