/* [<][>][^][v][top][bottom][index][help] */
DEFINITIONS
This source file includes following definitions.
- DlgLabeling
- getParameterType
- getParameters
- stateChanged
- addActionListener
- removeActionListener
- 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 DlgLabeling extends JPanel
implements ChangeListener, ParameterSetting
{
private JSlider jSlider_;
private ActionListener actionListener_;
public DlgLabeling() {
setLayout(new BorderLayout());
setBorder(new TitledBorder(GrpSim.res_.getString("DlgLabelingCaption")));
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("DlgLabelingSliderLabel"));
jPanel1.add(jLabel1);
jSlider_ = new JSlider();
jSlider_.setMajorTickSpacing(127);
jSlider_.setMinorTickSpacing(16);
jSlider_.setPaintLabels(true);
jSlider_.setPaintTicks(true);
jSlider_.setMinimum(1);
jSlider_.setMaximum(255);
jSlider_.setValue(255);
jSlider_.addChangeListener(this);
jPanel1.add(jSlider_);
add(jPanel1, BorderLayout.NORTH);
}
public int getParameterType() {
return ParameterSetting.PARAM_TYPE_LABELING;
}
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;
}
}