git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@428 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d
This commit is contained in:
kascade 2007-01-13 12:56:29 +00:00
parent f56b70dc49
commit 3af76b6a1a
2 changed files with 23 additions and 27 deletions

View File

@ -27,15 +27,8 @@ import enginuity.logger.EcuLogger;
import enginuity.maps.Rom;
import javax.management.modelmbean.XMLParseException;
import javax.swing.ButtonGroup;
import javax.swing.JFileChooser;
import javax.swing.*;
import static javax.swing.JFrame.DISPOSE_ON_CLOSE;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.JSeparator;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
@ -189,12 +182,9 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
}
public void updateMenu() {
String file = "";
try {
file = " " + parent.getLastSelectedRom().getFileName() + " ";
} catch (NullPointerException ex) {
}
if (file.equals("")) {
String file = getLastSelectedRomFileName();
if ("".equals(file)) {
saveImage.setEnabled(false);
closeImage.setEnabled(false);
closeAll.setEnabled(false);
@ -206,9 +196,9 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
romProperties.setEnabled(true);
}
saveImage.setText("Save" + file);
refreshImage.setText("Refresh" + file);
closeImage.setText("Close" + file);
saveImage.setText("Save " + file);
refreshImage.setText("Refresh " + file);
closeImage.setText("Close " + file);
romProperties.setText(file + "Properties");
}
@ -341,4 +331,9 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
}
}
}
private String getLastSelectedRomFileName() {
Rom lastSelectedRom = parent.getLastSelectedRom();
return lastSelectedRom == null ? "" : lastSelectedRom.getFileName() + " ";
}
}

View File

@ -22,6 +22,7 @@
package enginuity.swing;
import enginuity.ECUEditor;
import enginuity.maps.Rom;
import javax.swing.*;
import javax.swing.border.LineBorder;
@ -38,7 +39,6 @@ public class ECUEditorToolBar extends JToolBar implements ActionListener {
private JButton closeImage = new JButton(new ImageIcon("./graphics/icon-close.png"));
public ECUEditorToolBar(ECUEditor parent) {
super();
this.parent = parent;
this.setFloatable(false);
this.add(openImage);
@ -64,18 +64,14 @@ public class ECUEditorToolBar extends JToolBar implements ActionListener {
}
public void updateButtons() {
String file = "";
try {
file = " " + parent.getLastSelectedRom().getFileName();
} catch (NullPointerException ex) {
}
String file = getLastSelectedRomFileName();
openImage.setToolTipText("Open Image");
saveImage.setToolTipText("Save" + file);
refreshImage.setToolTipText("Refresh" + file + " from saved copy");
closeImage.setToolTipText("Close" + file);
saveImage.setToolTipText("Save " + file);
refreshImage.setToolTipText("Refresh " + file + " from saved copy");
closeImage.setToolTipText("Close " + file);
if (file.equals("")) {
if ("".equals(file)) {
saveImage.setEnabled(false);
refreshImage.setEnabled(false);
closeImage.setEnabled(false);
@ -112,4 +108,9 @@ public class ECUEditorToolBar extends JToolBar implements ActionListener {
}
}
}
private String getLastSelectedRomFileName() {
Rom lastSelectedRom = parent.getLastSelectedRom();
return lastSelectedRom == null ? "" : lastSelectedRom.getFileName() + " ";
}
}