Methods Summary |
---|
private void | buildActions()
actionsMap = new ActionMap();
actionsMap.put(OpenAction.ACTION_NAME, new OpenAction(this));
actionsMap.put(SaveAction.ACTION_NAME, new SaveAction(this));
actionsMap.put(ExitAction.ACTION_NAME, new ExitAction(this));
|
private void | buildContent()
setContentPane(new GradientPanel());
|
private void | buildMenuBar()
JMenu fileMenu = new JMenu("File");
JMenuItem openMenuItem = new JMenuItem();
saveMenuItem = new JMenuItem();
JMenuItem exitMenuItem = new JMenuItem();
openMenuItem.setAction(actionsMap.get(OpenAction.ACTION_NAME));
fileMenu.add(openMenuItem);
saveMenuItem.setAction(actionsMap.get(SaveAction.ACTION_NAME));
saveMenuItem.setEnabled(false);
fileMenu.add(saveMenuItem);
exitMenuItem.setAction(actionsMap.get(ExitAction.ACTION_NAME));
fileMenu.add(exitMenuItem);
JMenuBar menuBar = new JMenuBar();
menuBar.add(fileMenu);
setJMenuBar(menuBar);
|
public org.jdesktop.swingworker.SwingWorker | open(java.io.File file)
if (file == null) {
JFileChooser chooser = new JFileChooser();
chooser.setFileFilter(new PngFileFilter());
int choice = chooser.showOpenDialog(this);
if (choice == JFileChooser.APPROVE_OPTION) {
return new OpenTask(chooser.getSelectedFile());
} else {
return null;
}
} else {
return new OpenTask(file);
}
|
public org.jdesktop.swingworker.SwingWorker | save()
if (imageEditor == null) {
return null;
}
File file = imageEditor.chooseSaveFile();
return file != null ? new SaveTask(file) : null;
|
void | showImageEditor(java.awt.image.BufferedImage image, java.lang.String name)
getContentPane().removeAll();
imageEditor = new ImageEditorPanel(this, image, name);
add(imageEditor);
saveMenuItem.setEnabled(true);
validate();
repaint();
|
private void | showOpenFilePanel()
add(new OpenFilePanel(this));
|