Browse Source

refactoring:[MouseGame Class]: Auslagern der Zurücksetzen-Methode.

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

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

@ -77,12 +77,7 @@ public class MouseGame extends JFrame {
panel.setLayout(null); panel.setLayout(null);
JPanel nordWand = new JPanel(); JPanel nordWand = new JPanel();
nordWand.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
robot.mouseMove(200, 170);
}
});
extracted(nordWand);
nordWand.setBackground(new Color(0, 0, 0)); nordWand.setBackground(new Color(0, 0, 0));
nordWand.setBounds(0, 0, 696, 10); nordWand.setBounds(0, 0, 696, 10);
panel.add(nordWand); panel.add(nordWand);
@ -104,16 +99,21 @@ public class MouseGame extends JFrame {
JPanel panel_1 = new JPanel(); JPanel panel_1 = new JPanel();
panel_1.setBounds(801, 518, 83, 62); panel_1.setBounds(801, 518, 83, 62);
panel_1.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
robot.mouseMove(200, 170);
}
});
extracted(panel_1);
contentPane.add(panel_1); contentPane.add(panel_1);
}//end standardkonstruktor }//end standardkonstruktor
private void extracted(JPanel panel) {
panel.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
robot.mouseMove(200, 170);
}
});
}
}//end class }//end class
Loading…
Cancel
Save