Java source code of 'jhplot.jadraw.JaFillObject'

/*

 * Title: japlot.jaxodraw
 * Description: Graphical user interface for drawing Feynman diagrams
 * @author Daniele Binosi 
 * @author Lukas Theussl  

 Copyright (C) 2003-2006,  Daniele Binosi and Lukas Theussl

 See the file LICENSE in the source distribution home directory
 for a full copy of the GPL (GNU General Public License).

    This file is part of japlot.jaxodraw.

    japlot.jaxodraw 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 2 of the License, or
    (at your option) any later version.

    japlot.jaxodraw 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 this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


 */
package jhplot.jadraw;

import java.awt.Color;



/** A general object that can be filled. */
public abstract class JaFillObject extends JaObject {
    /** The fill color of this fillObject. */
    private Color fillcolor;

    /** The stroke (line width) of the border line of this fillObject. */
    private float stroke;

    // Bean getter and setter methods

    /** Returns the fill color of the fillColor object.
     * @return The fill color of this fillColor object.
     */
    public final Color getFillColor() {
        return fillcolor;
    }

    /** Sets the fill color of this fillColor object.
     * @param color The color to be set as fill color.
     */
    public final void setFillColor(Color color) {
        this.fillcolor = color;
    }

    /** Returns the stroke (line width) of this object.
     * @return The stroke of this object.
     */
    public final float getStroke() {
        return stroke;
    }

    /** Sets the stroke (line width) of this object.
     * @param newStroke The new stroke of this object.
     */
    public final void setStroke(float newStroke) {
        this.stroke = newStroke;
    }

    /** Returns the string that sets the latex line width of this FillObject.
     * @return The line width of this JaBlob.
     */
    public final String latexWidth() {
        String thisValue = Float.toString(getStroke() / 2.f);
        String base = "\\SetWidth{";
        String closing = "}";
        String lineWidth = base.concat(thisValue.concat(closing));

        return lineWidth;
    }
}