import java.awt.BorderLayout;
import java.awt.Dialog;
import java.awt.GridLayout;
+import java.awt.Image;
import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.io.File;
import javax.swing.BoxLayout;
+import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
ParameterPanelTime arg_basetime; // 開始画像の基準時刻:
ParameterPanelTime basetime; // 開始画像の基準時刻:
java.awt.Button closeButton;
+ JButton expandButton;
+ JButton zoomInButton;
+ JButton zoomOutButton;
+ JLabel imageLabel; // 開始画像の基準時刻画像表示
+ JScrollPane imageSPane; // スクロールパネル
/**
* コンストラクタ
* @param arg3_basetime 開始画像の基準時刻:
* @param owner
*/
+ @SuppressWarnings("OverridableMethodCallInConstructor")
public DialogCorectTime(ParameterPanelTime arg3_basetime, Dialog owner) {
super(owner, AdjustTime.i18n.getString("tab.restamp.300"), false);
this.arg_basetime = arg3_basetime;
//---- CENTER.CENTER -----
// 参考画像
- JLabel imageLabel = new JLabel();
- JScrollPane imageSPane = new JScrollPane(imageLabel);
+ imageLabel = new JLabel();
+ imageSPane = new JScrollPane(imageLabel);
centerPanel.add(imageSPane, BorderLayout.CENTER);
//---- CENTER.SOUTH -----
// 画像ファイル選択ダイアログを起動するボタン
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
- JButton openButton = new JButton(createImageIcon(java.util.ResourceBundle.getBundle("i18n_ja_JP").getString("IMAGES/FIT16.GIF")));
- buttonPanel.add(openButton);
- JButton zoomInButton = new JButton(createImageIcon("images/ZoomIn16.gif"));
+ expandButton = new JButton(createImageIcon(java.util.ResourceBundle.getBundle("i18n_ja_JP").getString("IMAGES/FIT16.GIF")));
+ buttonPanel.add(expandButton);
+ zoomInButton = new JButton(createImageIcon("images/ZoomIn16.gif"));
buttonPanel.add(zoomInButton);
- JButton zoomOutButton = new JButton(createImageIcon("images/ZoomOut16.gif"));
+ zoomOutButton = new JButton(createImageIcon("images/ZoomOut16.gif"));
buttonPanel.add(zoomOutButton);
centerPanel.add(buttonPanel, BorderLayout.SOUTH);
closeButton.setBounds(145,65,66,27);
add(closeButton, BorderLayout.SOUTH);
+ // 選択された画像ファイルを表示する
+ imageView_Action();
+
//{{REGISTER_LISTENERS
SymWindow aSymWindow = new SymWindow();
this.addWindowListener(aSymWindow);
SymAction lSymAction = new SymAction();
closeButton.addActionListener(lSymAction);
+ expandButton.addActionListener(lSymAction);
+ zoomInButton.addActionListener(lSymAction);
+ zoomOutButton.addActionListener(lSymAction);
//}}
}
if (object == closeButton) {
dialog_WindowClosing();
}
+ else if (object == expandButton) {
+ imageView_Action();
+ }
+ else if (object == zoomInButton) {
+ zoomin_Action();
+ }
+ else if (object == zoomOutButton) {
+ zoomout_Action();
+ }
+ }
+ }
+
+ ImageIcon refImage;
+
+ /**
+ * 選択された画像ファイルを表示する
+ * 基準画像ボタンがクリックされた時に、基準時刻フィールドに基準画像の作成日時を設定する。
+ */
+ @SuppressWarnings("UseSpecificCatch")
+ public void imageView_Action() {
+ int size_x = imageSPane.getWidth() - 8;
+ String path = arg_basetime.getImageFile().getImageFile().getAbsolutePath();
+ ImageIcon tmpIcon = new ImageIcon(path);
+ refImage = tmpIcon;
+ 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() {
+ if (refImage != null) {
+ int size_x = imageLabel.getWidth();
+ String path = arg_basetime.getImageFile().getImageFile().getAbsolutePath();
+ 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() {
+ 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();
+ }
+ }
+
/**
* ダイアログが閉じられるときのアクション
*/