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

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

DEFINITIONS

This source file includes following definitions.
  1. DlgContrast
  2. stateChanged
  3. addActionListener
  4. removeActionListener
  5. getParameterType
  6. getParameters
  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 DlgContrast extends JPanel
        implements ChangeListener, ParameterSetting
{
        private javax.swing.JSlider jSlider_;
        private ActionListener actionListener_;
        
        public DlgContrast() {
                setLayout(new BorderLayout());
                setBorder(new TitledBorder(GrpSim.res_.getString("MainMenuProcessingContrast")));
                Dimension dim = new Dimension(320, 240);
                setMaximumSize(dim);
                setMinimumSize(dim);
                setPreferredSize(dim);
                
                JPanel jPanel1 = new JPanel();
                jPanel1.setLayout(new BoxLayout(jPanel1, BoxLayout.Y_AXIS));
                
                JLabel jLabel1 = new JLabel();
                jLabel1.setText(GrpSim.res_.getString("DlgContrastSliderLabel"));
                jPanel1.add(jLabel1);
                
                jSlider_ = new JSlider();
                jSlider_.setMajorTickSpacing(2);
                jSlider_.setMinorTickSpacing(1);
                jSlider_.setPaintLabels(true);
                jSlider_.setPaintTicks(true);
                jSlider_.setSnapToTicks(true);
                jSlider_.setMinimum(-10);
                jSlider_.setMaximum(10);
                jSlider_.setValue(0);
                jSlider_.addChangeListener(this);
                jPanel1.add(jSlider_);
                
                add(jPanel1, BorderLayout.NORTH);
        }

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

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