import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.Label;
+import java.awt.Menu;
+import java.awt.MenuBar;
+import java.awt.MenuItem;
import java.awt.Panel;
import java.awt.TextField;
import java.awt.event.ActionEvent;
return str;
}
+ private boolean checkFileLoaded() {
+ return this.ic != null;
+ }
+
private void simulateOutput() {
// 設定値が変更されたときに canvasPreview 等を更新する
}
public void outputPdf() {
- if (ic == null) {
+ if (!checkFileLoaded()) {
labelMessage.setText(Lib.getMessage("No Input Files"));
this.validateTree();
return;
* (changed) { numberFieldPosterSize_setValue(); simulateOutput(); } }
*/
+ private void menuItemNewWindow_actionPerformed() {
+ MainFrame frame = new MainFrame();
+ frame.setVisible(true);
+ }
+
+ private void menuItemOpenFile_actionPerformed() {
+ FileDialog fd = new FileDialog(this, null, FileDialog.LOAD);
+ fd.setVisible(true);
+
+ if (fd.getFile() != null) {
+ String fileName = fd.getDirectory() + fd.getFile();
+ if (checkFileLoaded()) {
+ MainFrame frame = new MainFrame();
+ frame.changeFile(fileName);
+ frame.setVisible(true);
+ }
+ else {
+ changeFile(fileName);
+ }
+ }
+ }
+
+ private void menuItemCloseWindow_actionPerformed() {
+ this.dispose();
+ }
+
+ private void menuItemOutput_actionPerformed() {
+ outputPdf();
+ }
+
private void buttonSrcFileChange_actionPerformed() {
FileDialog fd = new FileDialog(this, null, FileDialog.LOAD);
fd.setVisible(true);
}
private void mainFrame_initializeComponents() {
+ this.setTitle(Program.LOWERTITLE);
+ this.setSize(800, 600);
+ this.setLocationRelativeTo(null);
+ this.addWindowListener(new WindowListener() {
+ public void windowActivated(WindowEvent e) {
+ }
+
+ public void windowClosed(WindowEvent e) {
+ }
+
+ public void windowClosing(WindowEvent e) {
+ dispose();
+ }
+
+ public void windowDeactivated(WindowEvent e) {
+ }
+
+ public void windowDeiconified(WindowEvent e) {
+ }
+
+ public void windowIconified(WindowEvent e) {
+ }
+
+ public void windowOpened(WindowEvent e) {
+ buttonOutput.requestFocus();
+ }
+ });
+
+ MenuBar menuBar = new MenuBar();
+ Menu menuFile = new Menu("File");
+ MenuItem menuItemNewWindow = new MenuItem(Lib.getMessage("New"));
+ menuItemNewWindow.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ menuItemNewWindow_actionPerformed();
+ }
+ });
+ MenuItem menuItemOpenFile = new MenuItem(Lib.getMessage("Open") + "...");
+ menuItemOpenFile.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ menuItemOpenFile_actionPerformed();
+ }
+ });
+ MenuItem menuItemCloseWindow = new MenuItem(Lib.getMessage("Close"));
+ menuItemCloseWindow.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ menuItemCloseWindow_actionPerformed();
+ }
+ });
+ MenuItem menuItemOutput = new MenuItem(Lib.getMessage("Output"));
+ menuItemOutput.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ menuItemOutput_actionPerformed();
+ }
+ });
+
labelSrcFile = new Label();
labelSrcFile.setText(Lib.getMessage("FileName"));
}
});
- this.setTitle(Program.LOWERTITLE);
- this.setSize(800, 600);
- this.setLocationRelativeTo(null);
- this.addWindowListener(new WindowListener() {
- public void windowActivated(WindowEvent e) {
- }
-
- public void windowClosed(WindowEvent e) {
- }
-
- public void windowClosing(WindowEvent e) {
- dispose();
- }
-
- public void windowDeactivated(WindowEvent e) {
- }
+ menuFile.add(menuItemNewWindow);
+ menuFile.add(menuItemOpenFile);
+ menuFile.addSeparator();
+ menuFile.add(menuItemCloseWindow);
+ menuFile.add(menuItemOutput);
- public void windowDeiconified(WindowEvent e) {
- }
-
- public void windowIconified(WindowEvent e) {
- }
-
- public void windowOpened(WindowEvent e) {
- buttonOutput.requestFocus();
- }
- });
+ menuBar.add(menuFile);
Panel panelSrcFile = new Panel();
panelSrcFile.setLayout(new FlowLayout(FlowLayout.LEFT));
panelOutput.add(buttonOutput);
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
+ this.setMenuBar(menuBar);
this.add(panelSrcFile);
this.add(panelSrc);
this.add(panelSrcRect);