public Processing(Box root) { super(null); Log.log("startup.processing", " processing plugin is starting up "); frame = new JFrame("Field/Processing"); __applet = new FieldProcessingApplet( sizeX, sizeY, queue, this, s -> { if (getLastErrorOutput() != null) getLastErrorOutput().accept(new Pair<>(-1, s)); }); __applet.init(); __applet.loop(); frame.add(__applet, BorderLayout.CENTER); frame.setSize(sizeX, sizeY); frame.setVisible(true); frame.validate(); applet = new FieldProcessingAppletDelgate(__applet); this.properties.put(P, applet); Log.log("startup.processing", " searching for boxes that need processing support "); Log.log("startup.processing", " processing plugin has finished starting up "); }
// {{{ handleError() method static void handleError(Component comp, Exception e) { Log.log(Log.ERROR, SearchAndReplace.class, e); if (comp instanceof Dialog) { new TextAreaDialog((Dialog) comp, beanshell ? "searcherror-bsh" : "searcherror", e); } else { new TextAreaDialog((Frame) comp, beanshell ? "searcherror-bsh" : "searcherror", e); } } // }}}
private void jMenuItemLoadLSAResultsActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jMenuItemLoadLSAResultsActionPerformed JFileChooser jfc = new JFileChooser(); int fileDialogReturnVal = jfc.showOpenDialog(this); if (fileDialogReturnVal == JFileChooser.APPROVE_OPTION) { try { File inputFile = jfc.getSelectedFile(); FileInputStream fis = new FileInputStream(inputFile); ObjectInputStream ois = new ObjectInputStream(fis); this.currentResults = (LSAResults) ois.readObject(); } catch (IOException e) { log.log(Log.ERROR, "Failed to load LSA results\n" + e.getMessage()); } catch (ClassNotFoundException e) { log.log(Log.ERROR, "Class not found : Error loading LSA results due to version mismatch"); } System.out.println(currentResults == null); } } // GEN-LAST:event_jMenuItemLoadLSAResultsActionPerformed
/** * Konstruktør. * * @param gameRenderer GameRendereren som eier objektet. * @param name Navnet til objektet. Blir default brukt som bildebasenavn */ GameObject(GameRenderer gameRenderer, String name, int objectX, int objectY) { dead = false; _name = name; _damage = 1; _age = 0; _xSpeed = _ySpeed = 0; x = objectX; y = objectY; _gameRenderer = gameRenderer; _movie = ImageMap.getInstance().getImage(name); if (_movie[0] == null) { Log.log("Couldn't find image for GameObject. Exiting."); System.exit(1); } width = _movie[0].getWidth(null); height = _movie[0].getHeight(null); }
private void jMenuItemSaveProjectActionPerformed( java.awt.event.ActionEvent evt) // GEN-FIRST:event_jMenuItemSaveProjectActionPerformed { // GEN-HEADEREND:event_jMenuItemSaveProjectActionPerformed if (this.theProject != null) { JFileChooser jfc = new JFileChooser(); int fileDialogReturnVal = jfc.showSaveDialog(this); if (fileDialogReturnVal == JFileChooser.APPROVE_OPTION) { try { File outputFile = jfc.getSelectedFile(); FileOutputStream fos = new FileOutputStream(outputFile); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(this.theProject); if (this.currentResults != null) { oos.writeObject(this.currentResults); } } catch (IOException e) { log.log(Log.ERROR, "Failed to save file\n" + e.getMessage()); } } } } // GEN-LAST:event_jMenuItemSaveProjectActionPerformed
private void jMenuItemLoadProjectActionPerformed( java.awt.event.ActionEvent evt) // GEN-FIRST:event_jMenuItemLoadProjectActionPerformed { // GEN-HEADEREND:event_jMenuItemLoadProjectActionPerformed JFileChooser jfc = new JFileChooser(); if (lastPath != null) { jfc.setCurrentDirectory(lastPath); } int fileDialogReturnVal = jfc.showOpenDialog(this); if (fileDialogReturnVal == JFileChooser.APPROVE_OPTION) { try { File inputFile = jfc.getSelectedFile(); FileInputStream fis = new FileInputStream(inputFile); ObjectInputStream ois = new ObjectInputStream(fis); this.theProject = (Project) ois.readObject(); this.currentResults = (LSAResults) ois.readObject(); lastPath = new File(jfc.getSelectedFile().getPath()); } catch (IOException e) { if (this.theProject == null) { log.log(Log.ERROR, "Failed to load project"); } if (this.currentResults == null) { log.log(Log.WARNING, "Failed to load results"); } log.log(Log.WARNING, e.getMessage()); } catch (ClassNotFoundException e) { log.log(Log.ERROR, "Class not found error, version mismatch"); } } if (this.theProject != null) { jMenuItemViewDocuments.setEnabled(true); jMenuItemSaveProject.setEnabled(true); this.setTitle(theProject.getProjectName()); log.log(Log.INFO, "Project Loaded"); } if (this.currentResults != null) { log.log(Log.INFO, "Results loaded"); } } // GEN-LAST:event_jMenuItemLoadProjectActionPerformed