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

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

DEFINITIONS

This source file includes following definitions.
  1. DlgDensityLine
  2. getParameterType
  3. getParameters
  4. stateChanged
  5. addActionListener
  6. removeActionListener
  7. requireSrc

package jp.ac.nime.computer.grpsimulator;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.border.TitledBorder;

/** 画像変換 境界線作成用 パラメタ設定ダイアログ
 *
 * @version 1.0.0
 * @author  igarashi
 */
public class DlgDensityLine extends JPanel
        implements ChangeListener, ParameterSetting
{
        private JSlider jSlider_;
        private ActionListener actionListener_;
        
        public DlgDensityLine() {
                setLayout(new BorderLayout());
                setBorder(new TitledBorder(GrpSim.res_.getString("DlgDensityLineCaption")));
                setMaximumSize(new Dimension(320, 240));
                setMinimumSize(new Dimension(320, 240));
                setPreferredSize(new Dimension(320, 240));
                
                JPanel jPanel1 = new JPanel();
                jPanel1.setLayout(new BoxLayout(jPanel1, BoxLayout.Y_AXIS));
                
                JLabel jLabel1 = new JLabel();
                jLabel1.setText(GrpSim.res_.getString("DlgDensityLineSliderLabel"));
                jPanel1.add(jLabel1);
                
                jSlider_ = new JSlider();
                jSlider_.setMajorTickSpacing(10);
                jSlider_.setMinorTickSpacing(2);
                jSlider_.setPaintLabels(true);
                jSlider_.setPaintTicks(true);
                jSlider_.setValue(100);
                jSlider_.addChangeListener(this);
                jPanel1.add(jSlider_);
                
                add(jPanel1, BorderLayout.NORTH);
        }

        public int getParameterType() {
                return ParameterSetting.PARAM_TYPE_DENSITYLINE;
        }    
        
        public int[] getParameters() {
                int ret[] = new int[1];
                ret[0] = jSlider_.getValue();
                return ret;
        }    
        
        public void stateChanged(ChangeEvent evt) {
                JSlider source = (JSlider) evt.getSource();
                if ( !source.getValueIsAdjusting() ) 
                        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 変換元画像を必要とするならtrueを返す
         */
        public boolean requireSrc() {
                return true;
        }
}

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