run() method) you may want to have more control on the way the time is counted. You can do that by using the following methods:run() method, such as cancelling a file chooserpublic void run() throws Exception { app.stopTime(this); // don't show the progress bar JFileChooser chooser = new JFileChooser("Open Image"); chooser.setDialogTitle("Open Image"); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); if (chooser.showOpenDialog(app.getApplicationWindow()) == JFileChooser.APPROVE_OPTION) { app.startTime(this); // show the progress bar and start to count File file = chooser.getSelectedFile(); BufferedImage image = ImageIO.read(file); if (image == null) throw new Exception("Bad File type"); JScrollPane pane = new JScrollPane(new ImagePanel(image)); app.addTab(pane, image, file.getName()); } else { app.noWriteMessages(); // will not write anything in the message area (in this case the file chooser has been cancelled) } }
@Override public boolean writeTimeMessages() { return false; }
Copyright 2006-2023 Herve Girod. All Rights Reserved. Documentation and source under the LGPL v2 and Apache 2.0 licences