|
@ -1,8 +1,10 @@ |
|
|
package de.hs_fulda.gruppenprojekt.JavaGamelauncher; |
|
|
package de.hs_fulda.gruppenprojekt.JavaGamelauncher; |
|
|
|
|
|
|
|
|
|
|
|
import java.awt.AWTException; |
|
|
import java.awt.Color; |
|
|
import java.awt.Color; |
|
|
import java.awt.EventQueue; |
|
|
import java.awt.EventQueue; |
|
|
import java.awt.Font; |
|
|
import java.awt.Font; |
|
|
|
|
|
import java.awt.Robot; |
|
|
|
|
|
|
|
|
import javax.swing.JFrame; |
|
|
import javax.swing.JFrame; |
|
|
import javax.swing.JLabel; |
|
|
import javax.swing.JLabel; |
|
@ -10,11 +12,15 @@ import javax.swing.JPanel; |
|
|
import javax.swing.SwingConstants; |
|
|
import javax.swing.SwingConstants; |
|
|
import javax.swing.border.EmptyBorder; |
|
|
import javax.swing.border.EmptyBorder; |
|
|
import javax.swing.border.LineBorder; |
|
|
import javax.swing.border.LineBorder; |
|
|
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
|
|
|
|
|
public class MouseGame extends JFrame { |
|
|
public class MouseGame extends JFrame { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JPanel contentPane; |
|
|
|
|
|
|
|
|
private JPanel contentPane; |
|
|
|
|
|
Robot robot = new Robot(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Launch the application. |
|
|
* Launch the application. |
|
@ -30,17 +36,17 @@ public class MouseGame extends JFrame { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}//end main |
|
|
}//end main |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public MouseGame() { |
|
|
|
|
|
|
|
|
public MouseGame() throws AWTException { |
|
|
|
|
|
|
|
|
//Fensterrahmen Haupt Layout |
|
|
//Fensterrahmen Haupt Layout |
|
|
setTitle("Maze Game"); |
|
|
setTitle("Maze Game"); |
|
|
setBounds(100, 100, 900, 650); |
|
|
setBounds(100, 100, 900, 650); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
contentPane = new JPanel(); |
|
|
contentPane = new JPanel(); |
|
|
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); |
|
|
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); |
|
|
setContentPane(contentPane); |
|
|
setContentPane(contentPane); |
|
@ -71,6 +77,12 @@ 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); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
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); |
|
|