diff --git a/importPicture/AdjustTime.bat b/importPicture/AdjustTime.bat new file mode 100644 index 0000000..da79b54 --- /dev/null +++ b/importPicture/AdjustTime.bat @@ -0,0 +1 @@ +javaw -jar AdjustTime.jar \ No newline at end of file diff --git a/importPicture/AdjustTime.sh b/importPicture/AdjustTime.sh new file mode 100644 index 0000000..845a742 --- /dev/null +++ b/importPicture/AdjustTime.sh @@ -0,0 +1 @@ +java -jar AdjustTime.jar diff --git a/importPicture/MatchTime.bat b/importPicture/MatchTime.bat deleted file mode 100644 index b68b169..0000000 --- a/importPicture/MatchTime.bat +++ /dev/null @@ -1 +0,0 @@ -javaw -jar MatchTime.jar \ No newline at end of file diff --git a/importPicture/MatchTime.sh b/importPicture/MatchTime.sh deleted file mode 100644 index 59e8a00..0000000 --- a/importPicture/MatchTime.sh +++ /dev/null @@ -1 +0,0 @@ -java -jar MatchTime.jar diff --git a/importPicture/build.xml b/importPicture/build.xml index 9a58d4f..e6d543b 100644 --- a/importPicture/build.xml +++ b/importPicture/build.xml @@ -1,6 +1,6 @@ - + @@ -14,7 +14,7 @@ - + @@ -69,7 +69,7 @@ - + @@ -89,7 +89,9 @@ + + diff --git a/importPicture/list.csv b/importPicture/list.csv deleted file mode 100644 index 230c703..0000000 --- a/importPicture/list.csv +++ /dev/null @@ -1,64 +0,0 @@ - �����F -324(sec) - Target GPX�F [4-02-22 145413.gpx] -GPX start time�F 2014-02-22T13:16:11 - GPX end time�F 2014-02-22T14:54:21 -"name","orignal","gpstime" -"IMG_0150.JPG","2014-02-22T13:30:20","2014-02-22T13:24:56" -"IMG_0151.JPG","2014-02-22T13:38:04","2014-02-22T13:32:40" -"IMG_0152.JPG","2014-02-22T13:39:06","2014-02-22T13:33:42" -"IMG_0153.JPG","2014-02-22T13:39:12","2014-02-22T13:33:48" -"IMG_0154.JPG","2014-02-22T13:39:16","2014-02-22T13:33:52" -"IMG_0155.JPG","2014-02-22T13:40:16","2014-02-22T13:34:52" -"IMG_0156.JPG","2014-02-22T13:40:44","2014-02-22T13:35:20" -"IMG_0157.JPG","2014-02-22T13:41:46","2014-02-22T13:36:22" -"IMG_0158.JPG","2014-02-22T13:42:32","2014-02-22T13:37:08" -"IMG_0159.JPG","2014-02-22T13:46:20","2014-02-22T13:40:56" -"IMG_0160.JPG","2014-02-22T13:47:06","2014-02-22T13:41:42" -"IMG_0161.JPG","2014-02-22T13:47:12","2014-02-22T13:41:48" -"IMG_0162.JPG","2014-02-22T13:47:40","2014-02-22T13:42:16" -"IMG_0163.JPG","2014-02-22T13:48:56","2014-02-22T13:43:32" -"IMG_0164.JPG","2014-02-22T13:49:24","2014-02-22T13:44:00" -"IMG_0165.JPG","2014-02-22T13:49:34","2014-02-22T13:44:10" -"IMG_0166.JPG","2014-02-22T13:51:02","2014-02-22T13:45:38" -"IMG_0167.JPG","2014-02-22T13:51:44","2014-02-22T13:46:20" -"IMG_0168.JPG","2014-02-22T13:53:56","2014-02-22T13:48:32" -"IMG_0169.JPG","2014-02-22T13:54:06","2014-02-22T13:48:42" -"IMG_0170.JPG","2014-02-22T13:54:40","2014-02-22T13:49:16" -"IMG_0171.JPG","2014-02-22T14:03:34","2014-02-22T13:58:10" -"IMG_0172.JPG","2014-02-22T14:03:38","2014-02-22T13:58:14" -"IMG_0173.JPG","2014-02-22T14:04:24","2014-02-22T13:59:00" -"IMG_0174.JPG","2014-02-22T14:04:44","2014-02-22T13:59:20" -"IMG_0175.JPG","2014-02-22T14:04:58","2014-02-22T13:59:34" -"IMG_0176.JPG","2014-02-22T14:05:10","2014-02-22T13:59:46" -"IMG_0177.JPG","2014-02-22T14:06:04","2014-02-22T14:00:40" -"IMG_0178.JPG","2014-02-22T14:08:12","2014-02-22T14:02:48" -"IMG_0179.JPG","2014-02-22T14:08:24","2014-02-22T14:03:00" -"IMG_0180.JPG","2014-02-22T14:08:30","2014-02-22T14:03:06" -"IMG_0181.JPG","2014-02-22T14:08:46","2014-02-22T14:03:22" -"IMG_0182.JPG","2014-02-22T14:09:02","2014-02-22T14:03:38" -"IMG_0183.JPG","2014-02-22T14:09:10","2014-02-22T14:03:46" -"IMG_0184.JPG","2014-02-22T14:10:14","2014-02-22T14:04:50" -"IMG_0185.JPG","2014-02-22T14:11:34","2014-02-22T14:06:10" -"IMG_0186.JPG","2014-02-22T14:11:54","2014-02-22T14:06:30" -"IMG_0187.JPG","2014-02-22T14:14:24","2014-02-22T14:09:00" -"IMG_0188.JPG","2014-02-22T14:15:02","2014-02-22T14:09:38" -"IMG_0189.JPG","2014-02-22T14:15:12","2014-02-22T14:09:48" -"IMG_0190.JPG","2014-02-22T14:15:16","2014-02-22T14:09:52" -"IMG_0191.JPG","2014-02-22T14:16:02","2014-02-22T14:10:38" -"IMG_0192.JPG","2014-02-22T14:18:46","2014-02-22T14:13:22" -"IMG_0193.JPG","2014-02-22T14:28:04","2014-02-22T14:22:40" -"IMG_0194.JPG","2014-02-22T14:28:30","2014-02-22T14:23:06" -"IMG_0195.JPG","2014-02-22T14:30:56","2014-02-22T14:25:32" -"IMG_0196.JPG","2014-02-22T14:31:00","2014-02-22T14:25:36" -"IMG_0197.JPG","2014-02-22T14:31:44","2014-02-22T14:26:20" -"IMG_0198.JPG","2014-02-22T14:32:12","2014-02-22T14:26:48" -"IMG_0199.JPG","2014-02-22T14:32:20","2014-02-22T14:26:56" -"IMG_0200.JPG","2014-02-22T14:32:32","2014-02-22T14:27:08" -"IMG_0201.JPG","2014-02-22T14:34:54","2014-02-22T14:29:30" -"IMG_0202.JPG","2014-02-22T14:35:12","2014-02-22T14:29:48" -"IMG_0203.JPG","2014-02-22T14:35:28","2014-02-22T14:30:04" -"IMG_0204.JPG","2014-02-22T14:35:44","2014-02-22T14:30:20" -"IMG_0205.JPG","2014-02-22T14:37:18","2014-02-22T14:31:54" -"IMG_0206.JPG","2014-02-22T14:37:32","2014-02-22T14:32:08" -"IMG_0207.JPG","2014-02-22T14:41:18","2014-02-22T14:35:54" -"IMG_0208.JPG","2014-02-22T14:42:42","2014-02-22T14:37:18" diff --git a/importPicture/src/osm/jp/gpx/matchtime/gui/AboutDialog.java b/importPicture/src/osm/jp/gpx/matchtime/gui/AboutDialog.java index b8b1ad4..69d2147 100644 --- a/importPicture/src/osm/jp/gpx/matchtime/gui/AboutDialog.java +++ b/importPicture/src/osm/jp/gpx/matchtime/gui/AboutDialog.java @@ -48,17 +48,17 @@ setLayout(null); setVisible(false); setSize(360,114); - label1 = new java.awt.Label(MatchTime.PROGRAM_NAME +" Version "+ MatchTime.PROGRAM_VARSION +" ("+ MatchTime.PROGRAM_UPDATE +")", Label.CENTER); + label1 = new java.awt.Label(AdjustTime.PROGRAM_NAME +" Version "+ AdjustTime.PROGRAM_VARSION +" ("+ AdjustTime.PROGRAM_UPDATE +")", Label.CENTER); label1.setBounds(10,10,340,20); add(label1); okButton = new java.awt.Button(); okButton.setLabel("OK"); okButton.setBounds(145,65,66,27); add(okButton); - label2 = new java.awt.Label("Copyright(C) 2014 yuuhayashi GPLv3.",Label.RIGHT); + label2 = new java.awt.Label("Copyright(C) 2014 yuuhayashi \n The MIT License (MIT).",Label.RIGHT); label2.setBounds(10,40,340,20); add(label2); - setTitle("About... "+ MatchTime.PROGRAM_NAME); + setTitle("About... "+ AdjustTime.PROGRAM_NAME); //}} //{{REGISTER_LISTENERS diff --git a/importPicture/src/osm/jp/gpx/matchtime/gui/AdjustTime.java b/importPicture/src/osm/jp/gpx/matchtime/gui/AdjustTime.java new file mode 100644 index 0000000..240a65e --- /dev/null +++ b/importPicture/src/osm/jp/gpx/matchtime/gui/AdjustTime.java @@ -0,0 +1,337 @@ +package osm.jp.gpx.matchtime.gui; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.io.File; +import javax.swing.*; + +/** + * 本プログラムのメインクラス + */ +@SuppressWarnings("serial") +public class AdjustTime extends JFrame +{ + public static final String PROGRAM_NAME = "AdjustTime for JOSM"; + public static final String PROGRAM_VARSION = "1.0"; + public static final String PROGRAM_UPDATE = "2014/06/30"; + + // Used for addNotify check. + boolean fComponentsAdjusted = false; + + //{{DECLARE_CONTROLS + JPanel argsPanel; // パラメータ設定パネル (上部) + JScrollPane imageSPane; // スクロールパネル + JLabel imageLabel; // 基準時刻画像表示 + JTextArea textArea; // 実行結果表示領域 + //ImagePreview imagePane; // 基準時刻画像表示 + ParameterPanelFolder arg1Panel_1; + ParameterPanelImageFile arg1Panel_2; + ParameterPanelTime arg1Panel_3; + JPanel buttonPanel; // ボタンパネル (下部) + JButton openButton; // [Fit]ボタン + JButton zoomInButton; // [Zoom in]ボタン + JButton zoomOutButton; // [Zoom out]ボタン + //}} + + //{{DECLARE_MENUS + java.awt.MenuBar mainMenuBar; + java.awt.Menu menu1; + java.awt.MenuItem miDoNewFileList; + java.awt.MenuItem miDoDirSize; + java.awt.MenuItem miDoReadXML; + java.awt.MenuItem miExit; + java.awt.Menu menu3; + java.awt.MenuItem miAbout; + //}} + + class SymWindow extends java.awt.event.WindowAdapter { + /** + * このFrameが閉じられるときの動作。 + * 終了確認のパネルを表示して、[OK]が押されたら終了する + */ + public void windowClosing(java.awt.event.WindowEvent event) { + Object object = event.getSource(); + if (object == AdjustTime.this) { + DbMang_WindowClosing(event); + } + } + } + + class SymAction implements java.awt.event.ActionListener { + public void actionPerformed(java.awt.event.ActionEvent event) { + Object object = event.getSource(); + if (object == miAbout) { + miAbout_Action(event); + } + else if (object == miExit) { + miExit_Action(event); + } + else if (object == openButton) { + imageView_Action(event); + } + else if (object == zoomInButton) { + zoomin_Action(event); + } + else if (object == zoomOutButton) { + zoomout_Action(event); + } + else if (object == arg1Panel_2.argField) { + imageView_Action(event); + } + else if (object == arg1Panel_2.openButton) { + selectImage_Action(event); + imageView_Action(event); + } + else if (object == arg1Panel_3.doButton) { + doButton_Action(event); + } + } + } + + /** + * データベース内のテーブルを一覧で表示するFrame + */ + public AdjustTime() + { + // INIT_CONTROLS + //setLayout(new BorderLayout()); + Container container = getContentPane(); + container.setLayout(new BorderLayout()); + setVisible(false); + setSize(getInsets().left + getInsets().right + 500,getInsets().top + getInsets().bottom + 480); + setTitle(AdjustTime.PROGRAM_NAME +" v"+ AdjustTime.PROGRAM_VARSION); + + // パラメータ設定パネル + argsPanel = new JPanel(); + argsPanel.setLayout(new BoxLayout(argsPanel, BoxLayout.Y_AXIS)); + arg1Panel_1 = new ParameterPanelFolder("対象フォルダ: ", "."); + argsPanel.add(arg1Panel_1); + arg1Panel_2 = new ParameterPanelImageFile("基準時刻画像: ", "", arg1Panel_1); + argsPanel.add(arg1Panel_2); + arg1Panel_3 = new ParameterPanelTime("  基準時刻: ", "yyyy-mm-ddTHH:MM:ss"); + argsPanel.add(arg1Panel_3); + + this.getContentPane().add(argsPanel, BorderLayout.NORTH); + + // 基準時刻画像表示 + imageLabel = new JLabel(); + imageSPane = new JScrollPane(imageLabel); + this.getContentPane().add(imageSPane, BorderLayout.CENTER); + + // 画像ファイル選択ダイアログを起動するボタン + buttonPanel = new JPanel(); + buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); + openButton = new JButton(createImageIcon("images/Fit16.gif")); + buttonPanel.add(openButton); + zoomInButton = new JButton(createImageIcon("images/ZoomIn16.gif")); + buttonPanel.add(zoomInButton); + zoomOutButton = new JButton(createImageIcon("images/ZoomOut16.gif")); + buttonPanel.add(zoomOutButton); + this.getContentPane().add(buttonPanel, BorderLayout.SOUTH); + + // INIT_MENUS + menu1 = new java.awt.Menu("File"); + miExit = new java.awt.MenuItem(QuitDialog.TITLE); + miExit.setFont(new Font("Dialog", Font.PLAIN, 12)); + menu1.add(miExit); + + miAbout = new java.awt.MenuItem("About..."); + miAbout.setFont(new Font("Dialog", Font.PLAIN, 12)); + + menu3 = new java.awt.Menu("Help"); + menu3.setFont(new Font("Dialog", Font.PLAIN, 12)); + menu3.add(miAbout); + + mainMenuBar = new java.awt.MenuBar(); + mainMenuBar.setHelpMenu(menu3); + mainMenuBar.add(menu1); + mainMenuBar.add(menu3); + setMenuBar(mainMenuBar); + + + //{{REGISTER_LISTENERS + SymWindow aSymWindow = new SymWindow(); + this.addWindowListener(aSymWindow); + SymAction lSymAction = new SymAction(); + miAbout.addActionListener(lSymAction); + miExit.addActionListener(lSymAction); + openButton.addActionListener(lSymAction); + zoomOutButton.addActionListener(lSymAction); + zoomInButton.addActionListener(lSymAction); + arg1Panel_2.argField.addActionListener(lSymAction); + arg1Panel_2.openButton.addActionListener(lSymAction); + arg1Panel_3.doButton.addActionListener(lSymAction); + //}} + } + + /** + * Shows or hides the component depending on the boolean flag b. + * @param b trueのときコンポーネントを表示; その他のとき, componentを隠す. + * @see java.awt.Component#isVisible + */ + public void setVisible(boolean b) { + if(b) { + setLocation(50, 50); + + } + super.setVisible(b); + } + + /** + * このクラスをインスタンスを生成して表示する。 + * コマンドラインの引数はありません。 + */ + static public void main(String args[]) { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + createAndShowGUI(); + } + }); + } + private static void createAndShowGUI() { + (new AdjustTime()).setVisible(true); + } + + public void addNotify() { + // Record the size of the window prior to calling parents addNotify. + Dimension d = getSize(); + + super.addNotify(); + + if (fComponentsAdjusted) + return; + + // Adjust components according to the insets + setSize(getInsets().left + getInsets().right + d.width, getInsets().top + getInsets().bottom + d.height); + Component components[] = getComponents(); + for (int i = 0; i < components.length; i++){ + Point p = components[i].getLocation(); + p.translate(getInsets().left, getInsets().top); + components[i].setLocation(p); + } + fComponentsAdjusted = true; + } + + void DbMang_WindowClosing(java.awt.event.WindowEvent event) { + setVisible(false); // hide the Manager + dispose(); // free the system resources + System.exit(0); // close the application + } + + void miAbout_Action(java.awt.event.ActionEvent event) { + // Action from About Create and show as modal + (new AboutDialog(this, true)).setVisible(true); + } + + void miExit_Action(java.awt.event.ActionEvent event) { + // Action from Exit Create and show as modal + //(new hayashi.yuu.tools.gui.QuitDialog(this, true)).setVisible(true); + (new QuitDialog(this, true)).setVisible(true); + } + + ImageIcon refImage; + + /** + * 選択された画像ファイルを表示する + * @param ev + */ + public void imageView_Action(ActionEvent ev) { + String path = (new File(arg1Panel_1.getText(), arg1Panel_2.getText())).getPath(); + int size_x = imageSPane.getWidth() - 8; + ImageIcon tmpIcon = new ImageIcon(path); + refImage = tmpIcon; + if (tmpIcon != null) { + if (tmpIcon.getIconWidth() > size_x) { + refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x, -1, Image.SCALE_DEFAULT)); + } + } + imageLabel.setIcon(refImage); + repaint(); + } + + public void zoomin_Action(ActionEvent ev) { + if (refImage != null) { + int size_x = imageLabel.getWidth(); + String path = (new File(arg1Panel_1.getText(), arg1Panel_2.getText())).getPath(); + ImageIcon tmpIcon = new ImageIcon(path); + refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x * 2, -1, Image.SCALE_DEFAULT)); + imageLabel.setIcon(refImage); + repaint(); + } + } + + public void zoomout_Action(ActionEvent ev) { + if (refImage != null) { + int size_x = imageLabel.getWidth(); + ImageIcon tmpIcon = refImage; + refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x / 2, -1, Image.SCALE_DEFAULT)); + imageLabel.setIcon(refImage); + repaint(); + } + } + + public void selectImage_Action(ActionEvent ev) { + JFileChooser fc; + + //Set up the file chooser. + File sdir = new File(arg1Panel_1.getText()); + System.out.println(sdir.getPath()); + if (sdir.isDirectory()) { + fc = new JFileChooser(sdir); + } + else { + fc = new JFileChooser(); + } + + //Add a custom file filter and disable the default + //(Accept All) file filter. + fc.addChoosableFileFilter(new ImageFilter()); + fc.setAcceptAllFileFilterUsed(false); + + //Add custom icons for file types. + fc.setFileView(new ImageFileView()); + + //Add the preview pane. + fc.setAccessory(new ImagePreview(fc)); + + //Show it. + int returnVal = fc.showDialog(this, "選択"); + + //Process the results. + if (returnVal == JFileChooser.APPROVE_OPTION) { + File file = fc.getSelectedFile(); + arg1Panel_2.argField.setText(file.getName()); + } + + //Reset the file chooser for the next time it's shown. + fc.setSelectedFile(null); + } + + /** Returns an ImageIcon, or null if the path was invalid. */ + public static ImageIcon createImageIcon(String path) { + java.net.URL imgURL = AdjustTime.class.getResource(path); + if (imgURL != null) { + return new ImageIcon(imgURL); + } else { + System.err.println("Couldn't find file: " + path); + return null; + } + } + + /** + * [実行]ボタンをクリックしたときの動作 + * @param event + */ + void doButton_Action(java.awt.event.ActionEvent event) { + arg1Panel_3.doButton.setEnabled(false); + + String[] argv = new String[4]; + argv[0] = "list.csv"; + argv[1] = arg1Panel_1.getText(); + argv[2] = arg1Panel_2.getText(); + argv[3] = arg1Panel_3.getText(); + (new DoDialog(this, argv)).setVisible(true); + + arg1Panel_3.doButton.setEnabled(true); + } + +} diff --git a/importPicture/src/osm/jp/gpx/matchtime/gui/MatchTime.java b/importPicture/src/osm/jp/gpx/matchtime/gui/MatchTime.java deleted file mode 100644 index 30054f6..0000000 --- a/importPicture/src/osm/jp/gpx/matchtime/gui/MatchTime.java +++ /dev/null @@ -1,337 +0,0 @@ -package osm.jp.gpx.matchtime.gui; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.io.File; -import javax.swing.*; - -/** - * 本プログラムのメインクラス - */ -@SuppressWarnings("serial") -public class MatchTime extends JFrame -{ - public static final String PROGRAM_NAME = "MatchTime for JOSM"; - public static final String PROGRAM_VARSION = "0.2"; - public static final String PROGRAM_UPDATE = "2014/06/28"; - - // Used for addNotify check. - boolean fComponentsAdjusted = false; - - //{{DECLARE_CONTROLS - JPanel argsPanel; // パラメータ設定パネル (上部) - JScrollPane imageSPane; // スクロールパネル - JLabel imageLabel; // 基準時刻画像表示 - JTextArea textArea; // 実行結果表示領域 - //ImagePreview imagePane; // 基準時刻画像表示 - ParameterPanelFolder arg1Panel_1; - ParameterPanelImageFile arg1Panel_2; - ParameterPanelTime arg1Panel_3; - JPanel buttonPanel; // ボタンパネル (下部) - JButton openButton; // [Fit]ボタン - JButton zoomInButton; // [Zoom in]ボタン - JButton zoomOutButton; // [Zoom out]ボタン - //}} - - //{{DECLARE_MENUS - java.awt.MenuBar mainMenuBar; - java.awt.Menu menu1; - java.awt.MenuItem miDoNewFileList; - java.awt.MenuItem miDoDirSize; - java.awt.MenuItem miDoReadXML; - java.awt.MenuItem miExit; - java.awt.Menu menu3; - java.awt.MenuItem miAbout; - //}} - - class SymWindow extends java.awt.event.WindowAdapter { - /** - * このFrameが閉じられるときの動作。 - * 終了確認のパネルを表示して、[OK]が押されたら終了する - */ - public void windowClosing(java.awt.event.WindowEvent event) { - Object object = event.getSource(); - if (object == MatchTime.this) { - DbMang_WindowClosing(event); - } - } - } - - class SymAction implements java.awt.event.ActionListener { - public void actionPerformed(java.awt.event.ActionEvent event) { - Object object = event.getSource(); - if (object == miAbout) { - miAbout_Action(event); - } - else if (object == miExit) { - miExit_Action(event); - } - else if (object == openButton) { - imageView_Action(event); - } - else if (object == zoomInButton) { - zoomin_Action(event); - } - else if (object == zoomOutButton) { - zoomout_Action(event); - } - else if (object == arg1Panel_2.argField) { - imageView_Action(event); - } - else if (object == arg1Panel_2.openButton) { - selectImage_Action(event); - imageView_Action(event); - } - else if (object == arg1Panel_3.doButton) { - doButton_Action(event); - } - } - } - - /** - * データベース内のテーブルを一覧で表示するFrame - */ - public MatchTime() - { - // INIT_CONTROLS - //setLayout(new BorderLayout()); - Container container = getContentPane(); - container.setLayout(new BorderLayout()); - setVisible(false); - setSize(getInsets().left + getInsets().right + 500,getInsets().top + getInsets().bottom + 480); - setTitle(MatchTime.PROGRAM_NAME +" v"+ MatchTime.PROGRAM_VARSION); - - // パラメータ設定パネル - argsPanel = new JPanel(); - argsPanel.setLayout(new BoxLayout(argsPanel, BoxLayout.Y_AXIS)); - arg1Panel_1 = new ParameterPanelFolder("対象フォルダ: ", "."); - argsPanel.add(arg1Panel_1); - arg1Panel_2 = new ParameterPanelImageFile("基準時刻画像: ", "", arg1Panel_1); - argsPanel.add(arg1Panel_2); - arg1Panel_3 = new ParameterPanelTime("  基準時刻: ", "yyyy-mm-ddTHH:MM:ss"); - argsPanel.add(arg1Panel_3); - - this.getContentPane().add(argsPanel, BorderLayout.NORTH); - - // 基準時刻画像表示 - imageLabel = new JLabel(); - imageSPane = new JScrollPane(imageLabel); - this.getContentPane().add(imageSPane, BorderLayout.CENTER); - - // 画像ファイル選択ダイアログを起動するボタン - buttonPanel = new JPanel(); - buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); - openButton = new JButton(createImageIcon("images/Fit16.gif")); - buttonPanel.add(openButton); - zoomInButton = new JButton(createImageIcon("images/ZoomIn16.gif")); - buttonPanel.add(zoomInButton); - zoomOutButton = new JButton(createImageIcon("images/ZoomOut16.gif")); - buttonPanel.add(zoomOutButton); - this.getContentPane().add(buttonPanel, BorderLayout.SOUTH); - - // INIT_MENUS - menu1 = new java.awt.Menu("File"); - miExit = new java.awt.MenuItem(QuitDialog.TITLE); - miExit.setFont(new Font("Dialog", Font.PLAIN, 12)); - menu1.add(miExit); - - miAbout = new java.awt.MenuItem("About..."); - miAbout.setFont(new Font("Dialog", Font.PLAIN, 12)); - - menu3 = new java.awt.Menu("Help"); - menu3.setFont(new Font("Dialog", Font.PLAIN, 12)); - menu3.add(miAbout); - - mainMenuBar = new java.awt.MenuBar(); - mainMenuBar.setHelpMenu(menu3); - mainMenuBar.add(menu1); - mainMenuBar.add(menu3); - setMenuBar(mainMenuBar); - - - //{{REGISTER_LISTENERS - SymWindow aSymWindow = new SymWindow(); - this.addWindowListener(aSymWindow); - SymAction lSymAction = new SymAction(); - miAbout.addActionListener(lSymAction); - miExit.addActionListener(lSymAction); - openButton.addActionListener(lSymAction); - zoomOutButton.addActionListener(lSymAction); - zoomInButton.addActionListener(lSymAction); - arg1Panel_2.argField.addActionListener(lSymAction); - arg1Panel_2.openButton.addActionListener(lSymAction); - arg1Panel_3.doButton.addActionListener(lSymAction); - //}} - } - - /** - * Shows or hides the component depending on the boolean flag b. - * @param b trueのときコンポーネントを表示; その他のとき, componentを隠す. - * @see java.awt.Component#isVisible - */ - public void setVisible(boolean b) { - if(b) { - setLocation(50, 50); - - } - super.setVisible(b); - } - - /** - * このクラスをインスタンスを生成して表示する。 - * コマンドラインの引数はありません。 - */ - static public void main(String args[]) { - SwingUtilities.invokeLater(new Runnable() { - public void run() { - createAndShowGUI(); - } - }); - } - private static void createAndShowGUI() { - (new MatchTime()).setVisible(true); - } - - public void addNotify() { - // Record the size of the window prior to calling parents addNotify. - Dimension d = getSize(); - - super.addNotify(); - - if (fComponentsAdjusted) - return; - - // Adjust components according to the insets - setSize(getInsets().left + getInsets().right + d.width, getInsets().top + getInsets().bottom + d.height); - Component components[] = getComponents(); - for (int i = 0; i < components.length; i++){ - Point p = components[i].getLocation(); - p.translate(getInsets().left, getInsets().top); - components[i].setLocation(p); - } - fComponentsAdjusted = true; - } - - void DbMang_WindowClosing(java.awt.event.WindowEvent event) { - setVisible(false); // hide the Manager - dispose(); // free the system resources - System.exit(0); // close the application - } - - void miAbout_Action(java.awt.event.ActionEvent event) { - // Action from About Create and show as modal - (new AboutDialog(this, true)).setVisible(true); - } - - void miExit_Action(java.awt.event.ActionEvent event) { - // Action from Exit Create and show as modal - //(new hayashi.yuu.tools.gui.QuitDialog(this, true)).setVisible(true); - (new QuitDialog(this, true)).setVisible(true); - } - - ImageIcon refImage; - - /** - * 選択された画像ファイルを表示する - * @param ev - */ - public void imageView_Action(ActionEvent ev) { - String path = (new File(arg1Panel_1.getText(), arg1Panel_2.getText())).getPath(); - int size_x = imageSPane.getWidth() - 8; - ImageIcon tmpIcon = new ImageIcon(path); - refImage = tmpIcon; - if (tmpIcon != null) { - if (tmpIcon.getIconWidth() > size_x) { - refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x, -1, Image.SCALE_DEFAULT)); - } - } - imageLabel.setIcon(refImage); - repaint(); - } - - public void zoomin_Action(ActionEvent ev) { - if (refImage != null) { - int size_x = imageLabel.getWidth(); - String path = (new File(arg1Panel_1.getText(), arg1Panel_2.getText())).getPath(); - ImageIcon tmpIcon = new ImageIcon(path); - refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x * 2, -1, Image.SCALE_DEFAULT)); - imageLabel.setIcon(refImage); - repaint(); - } - } - - public void zoomout_Action(ActionEvent ev) { - if (refImage != null) { - int size_x = imageLabel.getWidth(); - ImageIcon tmpIcon = refImage; - refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x / 2, -1, Image.SCALE_DEFAULT)); - imageLabel.setIcon(refImage); - repaint(); - } - } - - public void selectImage_Action(ActionEvent ev) { - JFileChooser fc; - - //Set up the file chooser. - File sdir = new File(arg1Panel_1.getText()); - System.out.println(sdir.getPath()); - if (sdir.isDirectory()) { - fc = new JFileChooser(sdir); - } - else { - fc = new JFileChooser(); - } - - //Add a custom file filter and disable the default - //(Accept All) file filter. - fc.addChoosableFileFilter(new ImageFilter()); - fc.setAcceptAllFileFilterUsed(false); - - //Add custom icons for file types. - fc.setFileView(new ImageFileView()); - - //Add the preview pane. - fc.setAccessory(new ImagePreview(fc)); - - //Show it. - int returnVal = fc.showDialog(this, "選択"); - - //Process the results. - if (returnVal == JFileChooser.APPROVE_OPTION) { - File file = fc.getSelectedFile(); - arg1Panel_2.argField.setText(file.getName()); - } - - //Reset the file chooser for the next time it's shown. - fc.setSelectedFile(null); - } - - /** Returns an ImageIcon, or null if the path was invalid. */ - public static ImageIcon createImageIcon(String path) { - java.net.URL imgURL = MatchTime.class.getResource(path); - if (imgURL != null) { - return new ImageIcon(imgURL); - } else { - System.err.println("Couldn't find file: " + path); - return null; - } - } - - /** - * [実行]ボタンをクリックしたときの動作 - * @param event - */ - void doButton_Action(java.awt.event.ActionEvent event) { - arg1Panel_3.doButton.setEnabled(false); - - String[] argv = new String[4]; - argv[0] = "list.csv"; - argv[1] = arg1Panel_1.getText(); - argv[2] = arg1Panel_2.getText(); - argv[3] = arg1Panel_3.getText(); - (new DoDialog(this, argv)).setVisible(true); - - arg1Panel_3.doButton.setEnabled(true); - } - -} diff --git a/importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanelFolder.java b/importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanelFolder.java index 3d02173..b6e84e4 100644 --- a/importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanelFolder.java +++ b/importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanelFolder.java @@ -36,7 +36,7 @@ //Create the open button. We use the image from the JLF //Graphics Repository (but we extracted it from the jar). - openButton = new JButton("選択...", MatchTime.createImageIcon("images/Open16.gif")); + openButton = new JButton("選択...", AdjustTime.createImageIcon("images/Open16.gif")); openButton.addActionListener(this); this.add(openButton); } diff --git a/importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanelTime.java b/importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanelTime.java index 4a1c1c8..0ad1680 100644 --- a/importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanelTime.java +++ b/importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanelTime.java @@ -13,7 +13,7 @@ public ParameterPanelTime(String label, String text) { super(label, text); - doButton = new JButton("処理実行", MatchTime.createImageIcon("images/media_playback_start.png")); + doButton = new JButton("処理実行", AdjustTime.createImageIcon("images/media_playback_start.png")); doButton.addActionListener(this); this.add(doButton); }