1 package micropolisj.gui;
3 import java.awt.FlowLayout;
4 import java.awt.KeyEventDispatcher;
5 import java.awt.KeyboardFocusManager;
6 import java.awt.event.KeyEvent;
9 import javax.swing.JFrame;
10 import javax.swing.JTextField;
11 import javax.swing.JToggleButton;
12 import javax.swing.WindowConstants;
14 import micropolisj.engine.Micropolis;
15 import micropolisj.engine.MicropolisTool;
16 import micropolisj.research.ResearchState;
18 public class CheatWindow extends JFrame implements KeyEventDispatcher{
35 private Map<MicropolisTool, JToggleButton>
toolBtns;
38 super(
"Let's cheat!");
44 setLayout(
new FlowLayout());
46 setLocationRelativeTo(null);
47 manager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
48 manager.addKeyEventDispatcher(
this);
50 setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
55 if(e.getID() == KeyEvent.KEY_PRESSED) {
56 if(e.getKeyCode() == KeyEvent.VK_ENTER) {
66 manager.removeKeyEventDispatcher(
this);