create world tab @param world
(final World world)
| 233 | * @param world |
| 234 | */ |
| 235 | public void createTab(final World world) { |
| 236 | setMinimumSize(new Dimension(500, 400)); |
| 237 | |
| 238 | if (tabbedPane == null) { |
| 239 | remove(infoPanel); |
| 240 | tabbedPane = new JTabbedPane(); |
| 241 | add(tabbedPane); |
| 242 | tabbedPane.addChangeListener(this); |
| 243 | } |
| 244 | |
| 245 | if (!worldTabs.containsKey(world)) { |
| 246 | // open new tab |
| 247 | final WorldTab tab = new WorldTab(this, world, false); |
| 248 | worldTabs.put(world, tab); |
| 249 | tabbedPane.addTab(tab.getWorld().getName(), tab); |
| 250 | } |
| 251 | // change current tab |
| 252 | tabbedPane.setSelectedComponent(worldTabs.get(world)); |
| 253 | |
| 254 | final WorldTab curTab = getSelectedTab(); |
| 255 | if (curTab != null) { |
| 256 | // update menu entry |
| 257 | menuWorldShowCursor.setState(curTab.getWorldPanel().isCursorEnabled()); |
| 258 | } |
| 259 | |
| 260 | if (world.getWorldFile() != null) { |
| 261 | WorldFileList.push(new WorldFileList.WorldFileEntry(world.getName(), new File(world.getWorldFile().getFilename()))); |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | /** |
| 266 | * Closes all tabs |
no test coverage detected