root/graph/JavaPopWeb/src/jp/ac/nime/computer/grpsimulator/DlgAnalyzeFourier.java

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. DlgAnalyzeFourier
  2. initComponents
  3. jButton2_ActionPerformed
  4. jButton1_ActionPerformed
  5. addActionListener
  6. removeActionListener
  7. getParameterType
  8. getParameters
  9. requireSrc
  10. resetState

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 DlgAnalyzeFourier extends JPanel
        implements OperationDialog, ParameterSetting
{
        
        private ActionListener actionListener_;

       private int nButton_;
  
        private JTextField jTextField_;
        private JButton jButton1_;
        private JButton jButton2_;

        /** Creates new form DlgAnalyzeFourier */
        public DlgAnalyzeFourier() {
                initComponents();
              nButton_ = 0;
        }
        
        /** This method is called from within the constructor to
         * initialize the form.
         */
    private void initComponents() {
                setLayout(new GridBagLayout());
                setBorder(new TitledBorder(GrpSim.res_.getString("DlgAnalyzeFourierCaption")));
                setPreferredSize(new Dimension(240, 240));
                
                GridBagConstraints gridBagConstraints = new GridBagConstraints();
                
                jButton1_ = new JButton();
                jButton1_.setText(GrpSim.res_.getString("DlgAnalyzeFourierButtonInit"));
                jButton1_.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                                jButton1_ActionPerformed(evt);
                        }
                });
                gridBagConstraints.gridx = 0;
                gridBagConstraints.gridy = 0;
                gridBagConstraints.gridwidth = 2;
                gridBagConstraints.insets = new Insets(10, 10, 10, 10);
                add(jButton1_, gridBagConstraints);
                
                JLabel jLabel = new JLabel();
                jLabel.setText(GrpSim.res_.getString("DlgAnalyzeFourierLabelLimit"));
                gridBagConstraints.gridy = 1;
                gridBagConstraints.gridwidth = 1;
                gridBagConstraints.insets = new Insets(10, 10, 0, 10);
                add(jLabel, gridBagConstraints);
                
                jTextField_ = new JTextField("50",3);
                jTextField_.setHorizontalAlignment(JTextField.RIGHT);
                gridBagConstraints.gridy = 2;
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
                gridBagConstraints.insets = new Insets(0, 10, 100, 10);
                add(jTextField_, gridBagConstraints);
                
                jButton2_ = new JButton();
                jButton2_.setText(GrpSim.res_.getString("DlgAnalyzeFourierButtonExec"));
                jButton2_.setEnabled(false);
                jButton2_.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                                jButton2_ActionPerformed(evt);
                        }
                });
                gridBagConstraints.gridx = 1;
                gridBagConstraints.gridy = 1;
                gridBagConstraints.gridheight = 2;
                gridBagConstraints.insets = new Insets(10, 10, 100, 10);
                add(jButton2_, gridBagConstraints);
        }

        private void jButton2_ActionPerformed(ActionEvent evt) {
                // 実行
                nButton_ = 2;
                actionListener_.actionPerformed(new ActionEvent(this,ActionEvent.ACTION_PERFORMED,"ParameterChanged"));
        }

        private void jButton1_ActionPerformed(ActionEvent evt) {
                // 2値化と境界線抽出
                nButton_ = 1;
                jButton2_.setEnabled(true);
                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_ANALYZE_FOURIER;
        }
        
        /** 変換のパラメータを取得します
         * @return パラメータを表す配列。内容については変換の種類に依存します。エラーはnullを返す。
         */
        public int[] getParameters() {
                // 押されたボタンの種類も判断できる
            int[] ret = new int[2];
                ret[0] = nButton_;
             ret[1] = Integer.valueOf(jTextField_.getText()).intValue();
                return ret;
        }
        
        /** 変換元画像を必要とするかどうかを返す
         * @return 変換元画像を必要とするならtrueを返す
         */
        public boolean requireSrc() {
                return false;
        }
        
        /** ダイアログの状態をリセットする  */
        public void resetState() {
             nButton_ = 0;
                jButton2_.setEnabled(false);
        }
        
}

/* [<][>][^][v][top][bottom][index][help] */