/*
 * 1.1+Swing version.
 */

import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.text.NumberFormat;

public class _113 extends JPanel {

    _22 _114;
    JComboBox _115;
    JSlider _116;

    _32 _117;

    _89 _118;

    _16[] _119;
    String _120;
    final static boolean _121 = false;
    final static boolean _122 = false;
    final static int _123 = 10000;

    _113(_89 _124, String _125, _16[] _126, _32 _127) {
        if (_122) {
            setBackground(Color.cyan);
        }
        setBorder(BorderFactory.createCompoundBorder(
                        BorderFactory.createTitledBorder(_125),
                        BorderFactory.createEmptyBorder(5, 5, 5, 5)));

        //Save arguments in instance variables.
        _118 = _124;
        _119 = _126;
        _120 = _125;
        _117 = _127;

        //Add the text field.  It initially displays "0" and needs
        //to be at least 10 columns wide.
        NumberFormat _128 = NumberFormat.getNumberInstance();
        _128.setMaximumFractionDigits(2);
        _114 = new _22(0, 10, _128);
        _114._30(_117._48());
        _114.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent _129) {
                _117._49(_114._27());
            }
        });

        //Add the combo box.
        _115 = new JComboBox();
        for (int _130 = 0; _130 < _119.length; _130++) { //Populate it.
            _115.addItem(_119[_130]._17);
        }
        _115.setSelectedIndex(0);
        _117._43(_119[0]._18);
        _115.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent _131) {
                //Set new maximums for the sliders.
                int _132 = _115.getSelectedIndex();
                _117._43(_119[_132]._18);
                _118._99(false);
            }
        });

        //Add the slider.
        _116 = new JSlider(_117);
        _117.addChangeListener(new ChangeListener(){
            public void stateChanged(ChangeEvent _133) {
                _114._30(_117._48());
            }
        });

        //Make the textfield/slider group a fixed size.
        JPanel _134 = new JPanel(){
            public Dimension getMinimumSize() {
                return getPreferredSize();
            }
            public Dimension getPreferredSize() {
                return new Dimension(150,
                                     super.getPreferredSize().height);
            }
            public Dimension getMaximumSize() {
                return getPreferredSize();
            }
        };
        if (_122) {
            _134.setBackground(Color.blue);
        }
        _134.setBorder(BorderFactory.createEmptyBorder(
                                                0, 0, 0, 5));
        _134.setLayout(new BoxLayout(_134,
                                          BoxLayout.Y_AXIS));
        _134.add(_114);
        _134.add(_116);

        setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
        add(_134);
        add(_115);
        _134.setAlignmentY(TOP_ALIGNMENT);
        _115.setAlignmentY(TOP_ALIGNMENT);
    }

    /** 
     * Returns the multiplier (units/meter) for the currently
     * selected unit of measurement.
     */
    public double _135() {
        return _117._42();
    }

    public double _136() {
        return _117._48();
    }
}