package jas2.bean;

import javax.swing.*;
import javax.swing.tree.*;
import java.awt.*;
import java.util.*;
import jas2.hist.*;
import jas2.swingstudio.*;

/**
 * A simple bean that provides easy control of some style settings via bean parameters.
 * @deprecated Use XMLPlot instead
 */

public class QuickPlot extends Plot
{
	public QuickPlot()
	{
		super();

		// set defaults similar to PAW
		m_hist.setBackground(Color.white);
	}

	public void setData(String data)
	{
		super.setData(data);
		m_hist.getYAxis().setLogarithmic(m_yAxisLogarithmic);
		m_hist.getYAxis().setAllowSuppressedZero(m_yAxisAllowSuppressedZero);
	}

	public String getPlotHeight()
	{
		Dimension dim = getPreferredSize();
		return Integer.toString(dim.height);
	}
	public void setPlotHeight(String heightValue)
	{
		try
		{
			Dimension dim = getPreferredSize();
			dim.height = Integer.parseInt(heightValue);
			setPreferredSize(dim);
		}
		catch(NumberFormatException e)
		{
		}
	}
	public String getPlotWidth()
	{
		Dimension dim = getPreferredSize();
		return Integer.toString(dim.width);
	}
	public void setPlotWidth(String widthValue)
	{
		try
		{
			Dimension dim = getPreferredSize();
			dim.width = Integer.parseInt(widthValue);
			setPreferredSize(dim);
		}
		catch(NumberFormatException e)
		{
		}
	}
	public String getBackgroundColor()
	{
		return m_hist.getBackground().toString();
	}
	public void setBackgroundColor(String colorValue)
	{
		try
		{
			Color color = Color.decode(colorValue);
			m_hist.setBackground(color);
		}
		catch (NumberFormatException e)
		{
		}
	}
	
	public String getXAxisLogarithmic()
	{
		return m_hist.getXAxis().isLogarithmic() ? "true" : "false";
	}
	public void setXAxisLogarithmic(String isLogValue)
	{
		Boolean isLog = new Boolean(isLogValue);
		m_hist.getXAxis().setLogarithmic(isLog.booleanValue());
	}
	public String getYAxisLogarithmic()
	{
		return m_hist.getYAxis().isLogarithmic() ? "true" : "false";
	}
	public void setYAxisLogarithmic(String isLogValue)
	{
		Boolean isLog = new Boolean(isLogValue);
		m_yAxisLogarithmic = isLog.booleanValue();
		m_hist.getYAxis().setLogarithmic(m_yAxisLogarithmic);
	}
	public String getXAxisAllowSuppressedZero()
	{
		return m_hist.getXAxis().getAllowSuppressedZero() ? "true" : "false";
	}
	public void setXAxisAllowSupressedZero(String allowValue)
	{
		Boolean allow = new Boolean(allowValue);
		m_hist.getXAxis().setAllowSuppressedZero(allow.booleanValue());
	}
	public String getYAxisAllowSuppressedZero()
	{
		return m_hist.getYAxis().getAllowSuppressedZero() ? "true" : "false";
	}
	public void setYAxisAllowSupressedZero(String allowValue)
	{
		Boolean allow = new Boolean(allowValue);
		m_yAxisAllowSuppressedZero = allow.booleanValue();
		m_hist.getYAxis().setAllowSuppressedZero(m_yAxisAllowSuppressedZero);
	}

	private boolean m_yAxisLogarithmic;
	private boolean m_yAxisAllowSuppressedZero; 
}

 

Ads help maintain this website.