Digital Image Processing (using Java)
Digital Image Processing (using Java)
Digital Image Processing (using Java)
- No tags were found...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
}char[] shortcut = { 'L', 'S', 'X' };for (int i = 0; i < 3; ++i) {JMenuItem item = new JMenuItem(itemName[i], shortcut[i]);item.addActionListener(this);menu.add(item);}// Handles Action events triggered by menu selectionspublic void actionPerformed(ActionEvent event) {String command = event.getActionCommand();if (command.startsWith("Load")) {load<strong>Image</strong>();repaint();}else if (command.startsWith("Save")) {saveHistogram();repaint();}else if (command.equals("Exit")) {setVisible(false);dispose();System.exit(0);}}// Loads a new image, computes its histogram and updates the GUIpublic void load<strong>Image</strong>() {fileChooser.setDialogTitle("Load image");if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {// Load image and compute its histogramtry {File file = fileChooser.getSelectedFile();<strong>Image</strong>Decoder input =<strong>Image</strong>File.create<strong>Image</strong>Decoder(file.getAbsolutePath());- 30 -