void writeAllSummons() { Layer[] layers = Layer.values(); for (int i = 0; i < layers.length; i++) { Layer layer = layers[i]; File summonsFile = new File("./config/" + layer.name() + ".summons"); try { ConfigParser.saveSummons(summonsFile, summonsOfLayers.get(i)); } catch (IOException e) { e.printStackTrace(); } } }
void readAllSummons() { Layer[] layers = Layer.values(); for (Layer layer : layers) { File summonsFile = new File("./config/" + layer.name() + ".summons"); try { List<Summon> summons = ConfigParser.loadSummons(summonsFile); summonsOfLayers.add(summons); } catch (IOException e) { e.printStackTrace(); } } }
public void init() { // Icon BufferedImage img = null; try { img = ImageIO.read(new File("img/icon/guiconfig.png")); } catch (IOException e) { } frame.setIconImage(img); Container cp = frame.getContentPane(); cp.setLayout(new BorderLayout()); cp.add(fileType, BorderLayout.CENTER); // fileType.addTab("Bindings", bindingLayers); fileType.addTab("Summons", summonLayers); fileType.addChangeListener(tabListener); // readAllBindings(); readAllSummons(); // Layer[] layers = Layer.values(); for (int i = 0; i < layers.length; i++) { Layer l = layers[i]; SummonPanel summonPanel = new SummonPanel(this, i); summonPanelByLayers.add(summonPanel); summonLayers.addTab(l.name(), summonPanel); BindingPanel bindingPanel = new BindingPanel(this, i); bindingPanelbyLayers.add(bindingPanel); bindingLayers.addTab(l.name(), bindingPanel); } summonLayers.addChangeListener(tabListener); bindingLayers.addChangeListener(tabListener); // fileType.setSelectedIndex(0); bindingLayers.setSelectedIndex(1); // frame.setJMenuBar(createJMenuBar()); // HACK trigger clean event // napkinSkin.setSelected(true); // actionPerformed(new ActionEvent(napkinSkin, 0, "")); frame.setSize(800, 600); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setLocationRelativeTo(null); frame.addWindowListener(new WindowListener()); frame.setVisible(true); dialogSaveState(true); }