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

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

DEFINITIONS

This source file includes following definitions.
  1. DlgLevelChange
  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;

/** 画像変換 ダイナミックレンジの拡大用 ダイアログ
 *
 * @author  igarashi
 */
public class DlgLevelChange extends JPanel
        implements ChangeListener, ParameterSetting
{
        private javax.swing.JSlider jSlider1_;
        private javax.swing.JSlider jSlider2_;
        private java.awt.event.ActionListener actionListener_;
        
        /** Creates new form DlgContrast */
        public DlgLevelChange() {
                setLayout(new BorderLayout());
                setBorder(new TitledBorder(GrpSim.res_.getString("DlgLevelChangeCaption")));
                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("DlgLevelChangeSliderLowLabel"));
                jPanel1.add(jLabel1);
                
                jSlider1_ = new JSlider();
                jSlider1_.setMajorTickSpacing(10);
                jSlider1_.setMinorTickSpacing(1);
                jSlider1_.setPaintLabels(true);
                jSlider1_.setPaintTicks(true);
                jSlider1_.setSnapToTicks(true);
                jSlider1_.setMinimum(0);
                jSlider1_.setMaximum(49);
                jSlider1_.setValue(0);
                jSlider1_.addChangeListener(this);
                jPanel1.add(jSlider1_);
                
                JLabel jLabel2 = new JLabel();
                jLabel2.setText(GrpSim.res_.getString("DlgLevelChangeSliderHighLabel"));
                jPanel1.add(jLabel2);
                
                jSlider2_ = new JSlider();
                jSlider2_.setMajorTickSpacing(10);
                jSlider2_.setMinorTickSpacing(1);
                jSlider2_.setPaintLabels(true);
                jSlider2_.setPaintTicks(true);
                jSlider2_.setSnapToTicks(true);
                jSlider2_.setMinimum(50);
                jSlider2_.setMaximum(100);
                jSlider2_.setValue(100);
                jSlider2_.addChangeListener(this);
                jPanel1.add(jSlider2_);
                
                add(jPanel1, BorderLayout.NORTH);
        }

        public int getParameterType() {
                return ParameterSetting.PARAM_TYPE_LEVELCHANGE;
        }
        
        public int[] getParameters() {
                int ret[] = new int[2];
                ret[0] = jSlider1_.getValue();
                ret[1] = jSlider2_.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] */