• R/O
  • HTTP
  • SSH
  • HTTPS

importpicture: Commit


Commit MetaInfo

Revisiona26dcd4603d8cdaa09dc875821d1f79e4f5b8203 (tree)
Time2019-10-14 14:36:53
Authorhaya4 <hayashi.yuu@gmai...>
Commiterhaya4

Log Message

fixed: Restamp 最初の画像選択と時刻の設定画面

Change Summary

Incremental Difference

--- a/src/osm/jp/gpx/matchtime/gui/restamp/DialogCorectTime.java
+++ b/src/osm/jp/gpx/matchtime/gui/restamp/DialogCorectTime.java
@@ -3,8 +3,12 @@ package osm.jp.gpx.matchtime.gui.restamp;
33 import java.awt.BorderLayout;
44 import java.awt.Dialog;
55 import java.awt.GridLayout;
6+import java.awt.Image;
67 import java.awt.Rectangle;
8+import java.awt.event.ActionEvent;
9+import java.io.File;
710 import javax.swing.BoxLayout;
11+import javax.swing.ImageIcon;
812 import javax.swing.JButton;
913 import javax.swing.JDialog;
1014 import javax.swing.JLabel;
@@ -25,12 +29,18 @@ public class DialogCorectTime extends JDialog implements PanelAction {
2529 ParameterPanelTime arg_basetime; // 開始画像の基準時刻:
2630 ParameterPanelTime basetime; // 開始画像の基準時刻:
2731 java.awt.Button closeButton;
32+ JButton expandButton;
33+ JButton zoomInButton;
34+ JButton zoomOutButton;
35+ JLabel imageLabel; // 開始画像の基準時刻画像表示
36+ JScrollPane imageSPane; // スクロールパネル
2837
2938 /**
3039 * コンストラクタ
3140 * @param arg3_basetime 開始画像の基準時刻:
3241 * @param owner
3342 */
43+ @SuppressWarnings("OverridableMethodCallInConstructor")
3444 public DialogCorectTime(ParameterPanelTime arg3_basetime, Dialog owner) {
3545 super(owner, AdjustTime.i18n.getString("tab.restamp.300"), false);
3646 this.arg_basetime = arg3_basetime;
@@ -70,19 +80,19 @@ public class DialogCorectTime extends JDialog implements PanelAction {
7080
7181 //---- CENTER.CENTER -----
7282 // 参考画像
73- JLabel imageLabel = new JLabel();
74- JScrollPane imageSPane = new JScrollPane(imageLabel);
83+ imageLabel = new JLabel();
84+ imageSPane = new JScrollPane(imageLabel);
7585 centerPanel.add(imageSPane, BorderLayout.CENTER);
7686
7787 //---- CENTER.SOUTH -----
7888 // 画像ファイル選択ダイアログを起動するボタン
7989 JPanel buttonPanel = new JPanel();
8090 buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
81- JButton openButton = new JButton(createImageIcon(java.util.ResourceBundle.getBundle("i18n_ja_JP").getString("IMAGES/FIT16.GIF")));
82- buttonPanel.add(openButton);
83- JButton zoomInButton = new JButton(createImageIcon("images/ZoomIn16.gif"));
91+ expandButton = new JButton(createImageIcon(java.util.ResourceBundle.getBundle("i18n_ja_JP").getString("IMAGES/FIT16.GIF")));
92+ buttonPanel.add(expandButton);
93+ zoomInButton = new JButton(createImageIcon("images/ZoomIn16.gif"));
8494 buttonPanel.add(zoomInButton);
85- JButton zoomOutButton = new JButton(createImageIcon("images/ZoomOut16.gif"));
95+ zoomOutButton = new JButton(createImageIcon("images/ZoomOut16.gif"));
8696 buttonPanel.add(zoomOutButton);
8797 centerPanel.add(buttonPanel, BorderLayout.SOUTH);
8898
@@ -92,11 +102,17 @@ public class DialogCorectTime extends JDialog implements PanelAction {
92102 closeButton.setBounds(145,65,66,27);
93103 add(closeButton, BorderLayout.SOUTH);
94104
105+ // 選択された画像ファイルを表示する
106+ imageView_Action();
107+
95108 //{{REGISTER_LISTENERS
96109 SymWindow aSymWindow = new SymWindow();
97110 this.addWindowListener(aSymWindow);
98111 SymAction lSymAction = new SymAction();
99112 closeButton.addActionListener(lSymAction);
113+ expandButton.addActionListener(lSymAction);
114+ zoomInButton.addActionListener(lSymAction);
115+ zoomOutButton.addActionListener(lSymAction);
100116 //}}
101117 }
102118
@@ -119,9 +135,58 @@ public class DialogCorectTime extends JDialog implements PanelAction {
119135 if (object == closeButton) {
120136 dialog_WindowClosing();
121137 }
138+ else if (object == expandButton) {
139+ imageView_Action();
140+ }
141+ else if (object == zoomInButton) {
142+ zoomin_Action();
143+ }
144+ else if (object == zoomOutButton) {
145+ zoomout_Action();
146+ }
147+ }
148+ }
149+
150+ ImageIcon refImage;
151+
152+ /**
153+ * 選択された画像ファイルを表示する
154+ * 基準画像ボタンがクリックされた時に、基準時刻フィールドに基準画像の作成日時を設定する。
155+ */
156+ @SuppressWarnings("UseSpecificCatch")
157+ public void imageView_Action() {
158+ int size_x = imageSPane.getWidth() - 8;
159+ String path = arg_basetime.getImageFile().getImageFile().getAbsolutePath();
160+ ImageIcon tmpIcon = new ImageIcon(path);
161+ refImage = tmpIcon;
162+ if (tmpIcon.getIconWidth() > size_x) {
163+ refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x, -1, Image.SCALE_DEFAULT));
122164 }
165+ imageLabel.setIcon(refImage);
166+ repaint();
167+ }
168+
169+ public void zoomin_Action() {
170+ if (refImage != null) {
171+ int size_x = imageLabel.getWidth();
172+ String path = arg_basetime.getImageFile().getImageFile().getAbsolutePath();
173+ ImageIcon tmpIcon = new ImageIcon(path);
174+ refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x * 2, -1, Image.SCALE_DEFAULT));
175+ imageLabel.setIcon(refImage);
176+ repaint();
177+ }
123178 }
124179
180+ public void zoomout_Action() {
181+ if (refImage != null) {
182+ int size_x = imageLabel.getWidth();
183+ ImageIcon tmpIcon = refImage;
184+ refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x / 2, -1, Image.SCALE_DEFAULT));
185+ imageLabel.setIcon(refImage);
186+ repaint();
187+ }
188+ }
189+
125190 /**
126191 * ダイアログが閉じられるときのアクション
127192 */
Show on old repository browser