private void addPlanetToPanel() { Iterator<Planet> iterator = starSystem.planetIterator(); while (iterator.hasNext()) { nextPlanet(iterator); setURL(); putPlanetImageToButton(); setupButton(imageButton[buttonIndex]); add(imageButton[buttonIndex]); increaseIndex(); } }
static void loadSystems() throws IOException { InputStream in = getInput(SYSTEMS_FNAME); Scanner sc = makeScanner(in); while (sc.hasNext()) try { StarSystem st = new StarSystem(); st.regionID = sc.nextInt(); st.constellationID = sc.nextInt(); st.id = sc.nextInt(); st.name = sc.next(); st.op = new double[] {sc.nextDouble(), sc.nextDouble(), sc.nextDouble()}; st.p = Arrays.copyOf(st.op, 3); st.border = (sc.nextInt() == 1); st.fringe = (sc.nextInt() == 1); st.corridor = (sc.nextInt() == 1); st.hub = (sc.nextInt() == 1); st.international = (sc.nextInt() == 1); st.regional = (sc.nextInt() == 1); st.constellation = (sc.nextInt() == 1); st.security = sc.nextFloat(); st.securityClass = sc.next(); st.isec = (int) (0.5f + 10.0f * st.security); if (st.isec < 0) st.isec = 0; systems.put(st.id, st); systemsByName.put(st.name.toLowerCase(), st); } catch (Exception e) { System.err.println("Parsing error loading systems."); if (sc.hasNext()) { System.err.println("Problematic token: " + sc.next()); } else { System.err.println("No tokens remaining."); } System.err.println("e"); sc.close(); in.close(); throw new RuntimeException(e); } sc.close(); in.close(); }