Sindbad~EG File Manager

Current Path : /usr/home/beeson/public_html/dynamicgeometry/org/dynamicgeometry/diagrammer/
Upload File :
Current File : /usr/home/beeson/public_html/dynamicgeometry/org/dynamicgeometry/diagrammer/Label.java

/**
 * This class is a Label for Geometric Objects.
 * File: Label.java
 *
 * This code is in the public domain.
 *
 * @author Brian Chan
 */

package org.dynamicgeometry.diagrammer;

import java.awt.geom.*;
import java.awt.*;

public class Label {

	// Determines of this object should be painted
	private boolean visible;

	// Determines the size of the font
	private int size;

	// The location of the top left corner of the bounding box of the Label text
	private Point2D location;

	// The Font used to display the String labelName
	private Font font;

	// The text displayed
	private String labelName;

	/**
	 * A constructor of a Label.
	 * Sets the default Font size of 12.
	 *
	 */
	public Label()
	{
		this.visible = true;
		this.setSize(12);
	}

	/**
	 * Returns the size of the Font.
	 *
	 * @return the size of font
	 */
	public int getSize()
	{
		return font.getSize();
	}

	/**
	 * Sets the size of Font.
	 *
	 * @param size the new value of the size of font
	 */
	public void setSize(int size)
	{
		this.size = size;

		// Default Font
		this.font = new Font("", Font.PLAIN, size);
	}

	/**
	 * Returns the font used to display the text.
	 *
	 * @return a reference to font
	 */
	public Font getFont()
	{
		return font;
	}

	/**
	 * Sets the font used to display the text.
	 *
	 * @param font the new value of font
	 */
	public void setFont(Font font)
	{
		this.font = font;
		this.size = font.getSize();
	}

	/**
	 * Returns the location of the top left corner of the box in which
	 * the Label's text is displayed.
	 *
	 * @return a reference to location
	 */
	public Point2D getLocation()
	{
		return location;
	}

	/**
	 * Sets the location of the top left corner of the box in which
	 * the Label's text is displayed.
	 *
	 * @param location the new value of location
	 */
	public void setLocation(Point2D location)
	{
		this.location = location;
	}

	/**
	 * Sets whether this Label is visible.
	 * true if this Label is visible
	 * false if this Label is not visisble
	 *
	 * @param visible the new value of visible
	 */
	public void setVisible(boolean visible)
	{
		this.visible = visible;
	}

	/**
	 * Returns the value of visible.
	 *
	 * @return the value of visible of this Label
	 */
	public boolean getVisible()
	{
		return this.visible;
	}

	/**
	 * Returns the value of labelName which is the text
	 * to be displayed.
	 *
	 * @return the value of labelName
	 */
	public String toString()
	{
		return labelName;
	}

	/**
	 * Sets the value of labelName, the text to be displayed by this Label.
	 *
	 * @param labelName the new value of labelName
	 */
	public void setLabel(String labelName)
	{
		this.labelName = labelName;
	}
}

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists