private void openButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openButtonActionPerformed
		final File dir = lastOpenDirectory();
		final JFileChooser chooser = dir != null
			? new JFileChooser(dir)
			: new JFileChooser();
		chooser.setDialogTitle("Choose Image");
		chooser.setDialogType(JFileChooser.OPEN_DIALOG);
		chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
		chooser.setMultiSelectionEnabled(false);
		chooser.addChoosableFileFilter(new FileNameExtensionFilter(
			format(
				"Images (%s)",
				Stream.of(ImageIO.getReaderFileSuffixes())
					.map(s -> format(" *.%s", s))
					.collect(Collectors.joining(","))
			),
			ImageIO.getReaderFileSuffixes()
		));

		final int returnVal = chooser.showOpenDialog(this);
		if (returnVal == JFileChooser.APPROVE_OPTION) {
			final File imageFile = chooser.getSelectedFile();
			try {
				update(ImageIO.read(imageFile));
				if (imageFile.getParentFile() != null) {
					lastOpenDirectory(imageFile.getParentFile());
				}
			} catch (IOException e) {
				JOptionPane.showMessageDialog(
					rootPane,
					format("Error while loading image '%s'.", imageFile),
					e.toString(),
					JOptionPane.ERROR_MESSAGE
				);
			}
		}
	}
private void openButtonActionPerformed ( java . awt . event . ActionEvent evt ) { final File dir = lastOpenDirectory ( ) ; final JFileChooser chooser = dir != null ? new JFileChooser ( dir ) : new JFileChooser ( ) ; chooser . setDialogTitle ( "Choose Image" ) ; chooser . setDialogType ( JFileChooser . OPEN_DIALOG ) ; chooser . setFileSelectionMode ( JFileChooser . FILES_ONLY ) ; chooser . setMultiSelectionEnabled ( false ) ; chooser . addChoosableFileFilter ( new FileNameExtensionFilter ( format ( "Images (%s)" , Stream . of ( ImageIO . getReaderFileSuffixes ( ) ) . map ( s -> format ( " *.%s" , s ) ) . collect ( Collectors . joining ( "," ) ) ) , ImageIO . getReaderFileSuffixes ( ) ) ) ; final int returnVal = chooser . showOpenDialog ( this ) ; if ( returnVal == JFileChooser . APPROVE_OPTION ) { final File imageFile = chooser . getSelectedFile ( ) ; try { update ( ImageIO . read ( imageFile ) ) ; if ( imageFile . getParentFile ( ) != null ) { lastOpenDirectory ( imageFile . getParentFile ( ) ) ; } } catch ( IOException e ) { JOptionPane . showMessageDialog ( rootPane , format ( "Error while loading image '%s'." , imageFile ) , e . toString ( ) , JOptionPane . ERROR_MESSAGE ) ; } } }
GEN-LAST:event_stopButtonActionPerformed