| 26 | import micropolisj.util.TranslationTool; |
| 27 | |
| 28 | public class MainWindow extends JFrame |
| 29 | implements Micropolis.Listener, EarthquakeListener |
| 30 | { |
| 31 | Micropolis engine; |
| 32 | MicropolisDrawingArea drawingArea; |
| 33 | JScrollPane drawingAreaScroll; |
| 34 | DemandIndicator demandInd; |
| 35 | MessagesPane messagesPane; |
| 36 | JLabel mapLegendLbl; |
| 37 | OverlayMapView mapView; |
| 38 | NotificationPane notificationPane; |
| 39 | EvaluationPane evaluationPane; |
| 40 | GraphsPane graphsPane; |
| 41 | JLabel dateLbl; |
| 42 | JLabel fundsLbl; |
| 43 | JLabel popLbl; |
| 44 | JLabel currentToolLbl; |
| 45 | JLabel currentToolCostLbl; |
| 46 | Map<MicropolisTool,JToggleButton> toolBtns; |
| 47 | EnumMap<MapState,JMenuItem> mapStateMenuItems = new EnumMap<MapState,JMenuItem>(MapState.class); |
| 48 | MicropolisTool currentTool; |
| 49 | File currentFile; |
| 50 | boolean doSounds = true; |
| 51 | boolean dirty1 = false; //indicates if a tool was successfully applied since last save |
| 52 | boolean dirty2 = false; //indicates if simulator took a step since last save |
| 53 | long lastSavedTime = 0; //real-time clock of when file was last saved |
| 54 | boolean autoBudgetPending; |
| 55 | |
| 56 | static ImageIcon appIcon; |
| 57 | static { |
| 58 | appIcon = new ImageIcon(MainWindow.class.getResource("/micropolism.png")); |
| 59 | } |
| 60 | |
| 61 | static ResourceBundle strings = ResourceBundle.getBundle("micropolisj.GuiStrings"); |
| 62 | static final String PRODUCT_NAME = strings.getString("PRODUCT"); |
| 63 | |
| 64 | public MainWindow() |
| 65 | { |
| 66 | this(new Micropolis()); |
| 67 | } |
| 68 | |
| 69 | public MainWindow(Micropolis engine) |
| 70 | { |
| 71 | setIconImage(appIcon.getImage()); |
| 72 | |
| 73 | this.engine = engine; |
| 74 | |
| 75 | JPanel mainArea = new JPanel(new BorderLayout()); |
| 76 | add(mainArea, BorderLayout.CENTER); |
| 77 | |
| 78 | drawingArea = new MicropolisDrawingArea(engine); |
| 79 | drawingAreaScroll = new JScrollPane(drawingArea); |
| 80 | mainArea.add(drawingAreaScroll); |
| 81 | |
| 82 | makeMenu(); |
| 83 | JToolBar tb = makeToolbar(); |
| 84 | mainArea.add(tb, BorderLayout.WEST); |
| 85 |
nothing calls this directly
no test coverage detected