/** This is executed every time we launch the tool using the menu item in Processing IDE */ public void run() { GCScheme.makeColorSchemes(); // Base base = editor.getBase(); Sketch sketch = editor.getSketch(); File sketchFolder = sketch.getFolder(); File sketchbookFolder = Base.getSketchbookFolder(); // Provide a warning (first time only) if G4P is not loaded if (!g4p_error_shown && !g4pJarExists(Base.getSketchbookLibrariesFolder())) { Base.showWarning( "GUI Builder error", "Although you can use this tool the sketch created will not \nwork because the G4P library needs to be installed.\nSee G4P at http://www.lagers.org.uk/g4p/", null); g4p_error_shown = true; } // The tool is not open so create the designer window if (dframe == null) { // If the gui.pde tab does not exist create it if (!guiTabExists(sketch)) { sketch.addFile(new File(sketchbookFolder, G4P_TOOL_DATA_FOLDER + SEP + PDE_TAB_NAME)); } // Create data folder if necessary sketch.prepareDataFolder(); // Create a sub-folder called 'GUI_BUILDER_DATA' inside the sketch folder if // it doesn't already exist File configFolder = new File(sketchFolder, CONFIG_FOLDER); if (!configFolder.exists()) { configFolder.mkdir(); } dframe = new GuiDesigner(editor); System.out.println("==================================================="); System.out.println(" G4PTool V2.2.1 created by Peter Lager"); System.out.println("==================================================="); // try { // BufferedImage img = ImageIO.read(new File(sketchbookFolder, G4P_TOOL_DATA_FOLDER + SEP + // "default_gui_palette.png")); // System.out.println("Image " + img); // } catch (IOException e) { // System.out.println("Unable to load colour schemes"); // e.printStackTrace(); // } } // Design window exists so make visible, open to normal size // and bring to front. dframe.setVisible(true); dframe.setExtendedState(JFrame.NORMAL); dframe.toFront(); }