|
@ -1,19 +1,29 @@ |
|
|
package pacmanGame; |
|
|
package pacmanGame; |
|
|
|
|
|
|
|
|
import java.awt.*; |
|
|
import java.awt.*; |
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
import javax.swing.*; |
|
|
|
|
|
|
|
|
public class Program { |
|
|
public class Program { |
|
|
|
|
|
|
|
|
public static JTextArea textArea; |
|
|
|
|
|
|
|
|
public MyKeyListener input; |
|
|
|
|
|
public JTextArea textArea; |
|
|
|
|
|
public JFrame frame; |
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
public static void main(String[] args) { |
|
|
createAndShowGUI(); |
|
|
|
|
|
|
|
|
Program instance = new Program(); |
|
|
|
|
|
instance.StartGame(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void StartGame() { |
|
|
|
|
|
|
|
|
|
|
|
CreateAndShowGUI(); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void createAndShowGUI() { |
|
|
|
|
|
JFrame frame = new JFrame("PacmaaaAAAYYYHAAAaaam"); |
|
|
|
|
|
|
|
|
public void CreateAndShowGUI() { |
|
|
|
|
|
frame = new JFrame("PacmaaaAAAYYYHAAAaaam"); |
|
|
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
|
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
|
|
|
|
|
|
|
frame.setSize(500, 665); |
|
|
frame.setSize(500, 665); |
|
@ -30,5 +40,8 @@ public class Program { |
|
|
frame.add(textArea, BorderLayout.CENTER); |
|
|
frame.add(textArea, BorderLayout.CENTER); |
|
|
frame.setLocationRelativeTo(null); |
|
|
frame.setLocationRelativeTo(null); |
|
|
frame.setVisible(true); |
|
|
frame.setVisible(true); |
|
|
|
|
|
|
|
|
|
|
|
input = new MyKeyListener(); |
|
|
|
|
|
frame.addKeyListener(input); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |