package crushtools.plot;
/*******************************************************************************
 * Copyright (c) 2014 Attila Kovacs <attila[AT]sigmyne.com>.
 * All rights reserved. 
 * 
 * This file is part of crushtools.
 * 
 *     crushtools is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 * 
 *     crushtools is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 * 
 *     You should have received a copy of the GNU General Public License
 *     along with crushtools.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * Contributors:
 *     Attila Kovacs <attila[AT]sigmyne.com> - initial API and implementation
 ******************************************************************************/
// (C)2007 Attila Kovacs <attila[AT]sigmyne.com>

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

public class ScaleBar extends Box {
	/**
	 * 
	 */
	private static final long serialVersionUID = 7156584300343311996L;
	
	public double min, max;
	public JTextField loField, hiField;
	public JCheckBox autoscale;
	public Border border;

	public JPanel range;

	public ScaleBar() {
		super(BoxLayout.Y_AXIS);

		Font font = new Font("MonoSpaced", Font.PLAIN, 10);
		setFont(font);

		range = new JPanel(new GridLayout(2,3));

		hiField = new JTextField("100.0", 4);
		loField = new JTextField("-100.0", 4);
		autoscale = new JCheckBox("auto scale");

		hiField.setHorizontalAlignment(JTextField.RIGHT);
		loField.setHorizontalAlignment(JTextField.RIGHT);

		//hiField.setActionCommand("HiField");
		//loField.setActionCommand("LoField");

		range.add(new JLabel("Max ")); range.add(hiField); range.add(new JLabel("mV"));
		range.add(new JLabel("Min ")); range.add(loField); range.add(new JLabel("mV"));

		border = BorderFactory.createEtchedBorder();
		border= BorderFactory.createTitledBorder(border, "Settings");

		add(range);
		add(createGlue());
		add(autoscale);

		setBorder(border);
	}    

	public double getLow() { return min; }
	public double getHigh() { return max; }

	
	
}



