Creates the GUI elements
(World world, boolean passive)
| 127 | * Creates the GUI elements |
| 128 | */ |
| 129 | private void createGui(World world, boolean passive){ |
| 130 | setLayout(new BorderLayout()); |
| 131 | |
| 132 | worldPanel = new WorldPanel(parentFrame, world, passive); |
| 133 | //add(worldPanel, BorderLayout.CENTER); |
| 134 | worldPanel.addTileSizeListener(this); |
| 135 | worldPanel.addStatusListener(this); |
| 136 | worldPanel.addPlaceSelectionListener(new PlaceSelectionListener() { |
| 137 | @Override |
| 138 | public void placeSelected(Place place) { |
| 139 | updateInfobar(); |
| 140 | } |
| 141 | |
| 142 | @Override |
| 143 | public void placeDeselected(Place place) { |
| 144 | updateInfobar(); |
| 145 | } |
| 146 | }); |
| 147 | |
| 148 | sidePanel = new SidePanel(world); |
| 149 | //add(sidePanel, BorderLayout.EAST); |
| 150 | sidePanel.addLayerPanelListener(this); |
| 151 | sidePanel.addPlacePanelListener(this); |
| 152 | |
| 153 | // add worldPanel and sidePanel to split pane to make them resizable |
| 154 | JSplitPane splitPaneCenter = new JSplitPane( |
| 155 | JSplitPane.HORIZONTAL_SPLIT, |
| 156 | worldPanel, sidePanel); |
| 157 | splitPaneCenter.setOneTouchExpandable(true); |
| 158 | splitPaneCenter.setDividerLocation(getWidth() - 100); |
| 159 | splitPaneCenter.setResizeWeight(1.0); |
| 160 | add(splitPaneCenter, BorderLayout.CENTER); |
| 161 | |
| 162 | Dimension worldPanelMinimumSize = new Dimension(300, 100); |
| 163 | Dimension sidePanelMinimumSize = new Dimension(150, 100); |
| 164 | worldPanel.setMinimumSize(worldPanelMinimumSize); |
| 165 | sidePanel.setMinimumSize(sidePanelMinimumSize); |
| 166 | |
| 167 | // create info bar |
| 168 | add(palInfoBar = new JPanel(), BorderLayout.SOUTH); |
| 169 | palInfoBar.setLayout(new BoxLayout(palInfoBar, BoxLayout.LINE_AXIS)); |
| 170 | |
| 171 | |
| 172 | // add bottom panel elements |
| 173 | // previous / next buttons for the history |
| 174 | JButton button_prev = new JButton("Prev"); |
| 175 | palInfoBar.add(button_prev); |
| 176 | button_prev.addActionListener(new ActionListener() { |
| 177 | @Override |
| 178 | public void actionPerformed(ActionEvent arg0) { |
| 179 | worldPanel.popPosition(); |
| 180 | } |
| 181 | }); |
| 182 | |
| 183 | JButton button_next = new JButton("Next"); |
| 184 | palInfoBar.add(button_next); |
| 185 | button_next.addActionListener(new ActionListener() { |
| 186 | @Override |
no test coverage detected