/** * Fetches a list of all valid power names. * * @return an array containing the name of each power */ public String[] getPowerNames() { Power[] powers = world.getMap().getPowers(); String[] powerNames = new String[powers.length]; for (int i = 0; i < powers.length; i++) { powerNames[i] = powers[i].getName(); } return powerNames; }
/** Sets the tab icons for each power. */ private void setTabIcons() { if (mmd != null) { final World world = clientFrame.getWorld(); final int tabCount = tabPane.getTabCount(); for (int i = 1; i < tabCount; i++) // no icon for 'game' info { Power power = world.getMap().getPower(tabPane.getTitleAt(i)); assert (power != null); String colorName = mmd.getPowerColor(power); Color color = SVGColorParser.parseColor(colorName); tabPane.setIconAt(i, new ColorRectIcon(12, 12, color)); } } } // setTabIcons()
/** Make the tab panel */ private void makeTabPanel() { // create tabbed pane tabPane = new JTabbedPane(); // first tab is Game info World world = clientFrame.getWorld(); tabPane.add(Utils.getLocalString(TAB_GAME_PANEL), makeGamePanel(world.getGameMetadata())); // all other tabs are by Power name Power[] powers = world.getMap().getPowers(); for (int i = 0; i < powers.length; i++) { tabPane.add( powers[i].getName(), makePlayerPanel(powers[i], world.getPlayerMetadata(powers[i]))); } } // makeTabPanel()