Class ShapeIcon

    • Constructor Detail

      • ShapeIcon

        public ShapeIcon​(NamedObj container,
                         java.lang.String name,
                         java.awt.Shape defaultShape)
                  throws IllegalActionException,
                         NameDuplicationException
        Create a new icon with the given name in the given container with the given default shape.
        Parameters:
        container - The container.
        name - The name of the attribute.
        defaultShape - The default shape, which is ignored by this constructor.
        Throws:
        IllegalActionException - If the attribute is not of an acceptable class for the container.
        NameDuplicationException - If the name coincides with an attribute already in the container.
    • Method Detail

      • clone

        public java.lang.Object clone​(Workspace workspace)
                               throws java.lang.CloneNotSupportedException
        Clone the object into the specified workspace. The new object is not added to the directory of that workspace (you must do this yourself if you want it there). The result is an object with no container.
        Overrides:
        clone in class DynamicEditorIcon
        Parameters:
        workspace - The workspace for the cloned object.
        Returns:
        The new Attribute.
        Throws:
        java.lang.CloneNotSupportedException - Not thrown in this base class
        See Also:
        NamedObj.exportMoML(Writer, int, String), NamedObj.setDeferringChangeRequests(boolean)
      • createBackgroundFigure

        public Figure createBackgroundFigure()
        Create a new default background figure, which is the shape set by setShape, if it has been called, or a small box if not. This must be called in the Swing thread, or a concurrent modification exception could occur.
        Overrides:
        createBackgroundFigure in class EditorIcon
        Returns:
        A figure representing the specified shape.
      • isCentered

        public boolean isCentered()
        Return whether the figure should be centered on its origin.
        Returns:
        False If the origin of the figure, as returned by getOrigin(), is the upper left corner.
      • setCentered

        public void setCentered​(boolean centered)
        Specify whether the figure should be centered or not. By default, the origin of the figure is the center. This is deferred and executed in the Swing thread.
        Parameters:
        centered - False to make the figure's origin at the upper left.
      • setDashArray

        public void setDashArray​(float[] dashArray)
        Specify the dash array to use for rendering lines. This is deferred and executed in the Swing thread.
        Parameters:
        dashArray - The dash array.
      • setFillColor

        public void setFillColor​(java.awt.Color fillColor)
        Specify the fill color to use. This is deferred and executed in the Swing thread.
        Parameters:
        fillColor - The fill color to use.
      • setLineColor

        public void setLineColor​(java.awt.Color lineColor)
        Specify the line color to use. This is deferred and executed in the Swing thread.
        Parameters:
        lineColor - The line color to use.
      • setLineWidth

        public void setLineWidth​(float lineWidth)
        Specify the line width to use. This is deferred and executed in the Swing thread.
        Parameters:
        lineWidth - The line width to use.
      • setRotation

        public void setRotation​(double angle)
        Specify the rotation angle in radians. This is deferred and executed in the Swing thread.
        Parameters:
        angle - The rotation angle in radians.
      • setShape

        public void setShape​(java.awt.Shape path)
        Specify a path to display. This is deferred and executed in the Swing thread.
        Parameters:
        path - The path to display.