/* [<][>][^][v][top][bottom][index][help] */
DEFINITIONS
This source file includes following definitions.
- DlgMeasureTrim
- initComponents
- jButton3_ActionPerformed
- jButton2_ActionPerformed
- jButton1_ActionPerformed
- resetState
- addActionListener
- removeActionListener
- getParameterType
- getParameters
- getStepCount
- requireSrc
- setStepDone
- setStepResult
package jp.ac.nime.computer.grpsimulator;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.TitledBorder;
/** 画像計測 切り出し用パラメタ設定ダイアログ
*
* @version 1.0.0
* @author igarashi
*/
public class DlgMeasureTrim extends JPanel
implements OperationDialog, SteppingParameter
{
private JButton jButton1_;
private JButton jButton2_;
private JButton jButton3_;
private ActionListener actionListener_;
private int nStepCount_; // 状態を示す
/** Creates new form DlgMeasureTrim */
public DlgMeasureTrim() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
*/
private void initComponents() {
setLayout(new FlowLayout(FlowLayout.CENTER, 65536, 20));
setBorder(new TitledBorder(GrpSim.res_.getString("DlgMeasureTrimCaption")));
setPreferredSize(new Dimension(240, 240));
jButton1_ = new JButton();
jButton1_.setText(GrpSim.res_.getString("DlgMeasureTrimButtonBinary"));
jButton1_.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
jButton1_ActionPerformed(evt);
}
});
add(jButton1_);
jButton2_ = new JButton();
jButton2_.setText(GrpSim.res_.getString("DlgMeasureTrimButtonStep"));
jButton2_.setEnabled(false);
jButton2_.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
jButton2_ActionPerformed(evt);
}
});
add(jButton2_);
jButton3_ = new JButton();
jButton3_.setText(GrpSim.res_.getString("DlgMeasureTrimButtonFinal"));
jButton3_.setEnabled(false);
jButton3_.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
jButton3_ActionPerformed(evt);
}
});
add(jButton3_);
}
private void jButton3_ActionPerformed(ActionEvent evt) {
nStepCount_ = -1;
jButton2_.setEnabled(false);
jButton3_.setEnabled(false);
actionListener_.actionPerformed(new ActionEvent(this,ActionEvent.ACTION_PERFORMED,"ParameterChanged"));
}
private void jButton2_ActionPerformed(ActionEvent evt) {
nStepCount_++;
actionListener_.actionPerformed(new ActionEvent(this,ActionEvent.ACTION_PERFORMED,"ParameterChanged"));
}
private void jButton1_ActionPerformed(ActionEvent evt) {
nStepCount_ = 1;
jButton2_.setEnabled(true);
jButton3_.setEnabled(true);
actionListener_.actionPerformed(new ActionEvent(this,ActionEvent.ACTION_PERFORMED,"ParameterChanged"));
}
/** ダイアログの状態をリセットする */
public void resetState() {
nStepCount_ = 0;
jButton2_.setEnabled(false);
jButton3_.setEnabled(false);
actionListener_.actionPerformed(new ActionEvent(this,ActionEvent.ACTION_PERFORMED,"ParameterChanged"));
}
public void addActionListener(ActionListener listener) {
actionListener_ = AWTEventMulticaster.add(actionListener_, listener);
}
public void removeActionListener(ActionListener listener) {
actionListener_ = AWTEventMulticaster.remove(actionListener_, listener);
}
/** 変換の種類を取得します
* @return 変換の種類を表す値
*/
public int getParameterType() {
return ParameterSetting.PARAM_TYPE_MEASURE_TRIM;
}
/** 変換のパラメータを取得します
* @return パラメータを表す配列。内容については変換の種類に依存します。
*/
public int[] getParameters() {
int[] ret = new int[1];
ret[0] = nStepCount_;
return ret;
}
/** 現在のステップ数を返す
* @return 現在のステップ数。-1はステップが完了している事を表す。
*/
public int getStepCount() {
return nStepCount_;
}
/** 変換元画像を必要とするかどうかを返す
* @return 変換元画像を必要とするならtrueを返す
*/
public boolean requireSrc() {
return true;
}
/** ステップがすべて完了した
*/
public void setStepDone() {
nStepCount_ = -1;
jButton2_.setEnabled(false);
jButton3_.setEnabled(false);
}
/** ステップごとの処理結果
*/
public void setStepResult(Object obj) {
}
}