Class TextBox

    • Constructor Detail

      • TextBox

        public TextBox()
        Creates a new, empty text box that can be placed in a deck. The initial size of the box is 72 pt by 72 pt.
      • TextBox

        public TextBox​(java.lang.String text,
                       double widthInPts,
                       double heightInPts)
        Creates a new text box with the specified text and initial size (measured in points).
    • Method Detail

      • getUprightWidth

        protected double getUprightWidth()
        Description copied from class: AbstractRenderedItem
        Return the width of this item in its standard, upright orientation.
        Specified by:
        getUprightWidth in class AbstractRenderedItem
        Returns:
        the width of the unoriented item
      • getUprightHeight

        protected double getUprightHeight()
        Description copied from class: AbstractRenderedItem
        Return the height of this item in its standard, upright orientation.
        Specified by:
        getUprightHeight in class AbstractRenderedItem
        Returns:
        the height of the unoriented item
      • getFillColor

        public java.awt.Color getFillColor()
        Description copied from interface: ShapeStyle
        Returns the fill colour used when painting the item.
        Specified by:
        getFillColor in interface ShapeStyle
        Returns:
        the background colour
      • setFillColor

        public void setFillColor​(java.awt.Color color)
        Description copied from interface: ShapeStyle
        Sets the fill colour used when painting the item.
        Specified by:
        setFillColor in interface ShapeStyle
        Parameters:
        color - the fill colour to use
      • getText

        public java.lang.String getText()
      • setText

        public void setText​(java.lang.String text)
      • getDragHandles

        public DragHandle[] getDragHandles()
        Description copied from class: AbstractItem
        Returns an array of the custom DragHandles for this item. If the item has no handles, returns null.

        Concrete subclasses should create an array of handles on demand and cache them in the dragHandles field in order to ensure that handles are not shared between copies of the item. Example:

         public DragHandle[] getDragHandles() {
             if( dragHandles == null ) {
                 dragHandles = new DragHandle[] { ... };
             }
             return dragHandles;
         }
         
        Specified by:
        getDragHandles in interface PageItem
        Overrides:
        getDragHandles in class AbstractItem
        Returns:
        an array of drag handles that can be used to manipulate the item, or null
      • clone

        public PageItem clone()
        Description copied from interface: PageItem
        Returns a new page item, using this item as a template. The new item should generally be a deep copy, not sharing any objects with the original unless those objects are immutable. The deck editor absolutely relies on this method being implemented correctly! (For example, drag-and-drop and clipboard operations use clones to create copies of existing items.)
        Specified by:
        clone in interface PageItem
        Overrides:
        clone in class AbstractRenderedItem
        Returns:
        a new copy of this page item
      • paint

        public void paint​(java.awt.Graphics2D g,
                          RenderTarget target,
                          double renderResolutionHint)
        Description copied from interface: PageItem
        Paint this item at its current location. The graphics context will be scaled so that 1 unit represents 1 point. The resolution hint is a suggestion as to the resolution the item should be rendered at if it must be converted to a bitmap before being drawn. It may or may not represent the actual resolution of the output target.
        Specified by:
        paint in interface PageItem
        Overrides:
        paint in class AbstractRenderedItem
        Parameters:
        g - the graphics context to paint to
        target - the type of destination being drawn to
        renderResolutionHint - a source resolution hint
      • renderImage

        protected java.awt.image.BufferedImage renderImage​(RenderTarget target,
                                                           double resolution)
        Description copied from class: AbstractRenderedItem
        Render an image based on the target and resolution hints. This is called whenever the item's image is required. The image should always be rendered in the upright, unmirrored position. An oriented image will be generated automatically as needed.

        It is recommended that subclasses cache results if possible, in which case AbstractRenderedItem.clearCachedImages() should be overridden to clear the cached result before calling the super implementation.

        Specified by:
        renderImage in class AbstractRenderedItem
        Parameters:
        target - the target type for rendering
        resolution - the resolution that the item should be rendered at
        Returns:
        an image representing the item's current state
      • createMarkupRenderer

        protected MarkupRenderer createMarkupRenderer​(double resolution)
      • getName

        public java.lang.String getName()
        Description copied from interface: PageItem
        Return the user-friendly short name of this item.
        Specified by:
        getName in interface PageItem
        Returns:
        a name that describes the card or its general kind
      • setSize

        public void setSize​(double width,
                            double height)
        Description copied from interface: SizablePageItem
        Set the new size of this item, in points.
        Specified by:
        setSize in interface SizablePageItem
        Parameters:
        width - the new width of the item
        height - the new height of the item
      • getShrink

        public boolean getShrink()
      • setShrink

        public void setShrink​(boolean shrink)
      • setX

        public void setX​(double x)
        Description copied from interface: PageItem
        Set the x-location of this item.
        Specified by:
        setX in interface PageItem
        Overrides:
        setX in class AbstractItem
        Parameters:
        x - the new x-location
      • setY

        public void setY​(double y)
        Description copied from interface: PageItem
        Set the y-location of this item.
        Specified by:
        setY in interface PageItem
        Overrides:
        setY in class AbstractItem
        Parameters:
        y - the new y-location
      • getOutlineColor

        public java.awt.Color getOutlineColor()
        Description copied from interface: OutlineStyle
        Returns the color used to draw the outline.
        Specified by:
        getOutlineColor in interface OutlineStyle
        Returns:
        the outline color
      • setOutlineColor

        public void setOutlineColor​(java.awt.Color borderColor)
        Description copied from interface: OutlineStyle
        Sets the color used to draw the outline.
        Specified by:
        setOutlineColor in interface OutlineStyle
        Parameters:
        borderColor - the outline color
      • getOutlineWidth

        public float getOutlineWidth()
        Description copied from interface: OutlineStyle
        Returns the width, in points, of the outline.
        Specified by:
        getOutlineWidth in interface OutlineStyle
        Returns:
        the outline line width
      • setOutlineWidth

        public void setOutlineWidth​(float borderWidth)
        Description copied from interface: OutlineStyle
        Sets the width, in points, of the outline.
        Specified by:
        setOutlineWidth in interface OutlineStyle
        Parameters:
        borderWidth - the outline width
      • setOutlineDashPattern

        public void setOutlineDashPattern​(DashPattern pat)
        Description copied from interface: OutlineStyle
        Sets the dash pattern used to draw the outline.
        Specified by:
        setOutlineDashPattern in interface OutlineStyle
        Parameters:
        pat - the dash pattern type
      • getOutlineJoin

        public LineJoin getOutlineJoin()
        Description copied from interface: OutlineStyle
        Returns the method used to join the line segments that make up the outline.
        Specified by:
        getOutlineJoin in interface OutlineStyle
        Returns:
        the line joining method
      • setOutlineJoin

        public void setOutlineJoin​(LineJoin join)
        Description copied from interface: OutlineStyle
        Sets the method used to join the line segments that make up the outline.
        Specified by:
        setOutlineJoin in interface OutlineStyle
        Parameters:
        join - the line joining method
      • setOutlineCap

        public void setOutlineCap​(LineCap cap)
        Description copied from interface: OutlineStyle
        Sets the line cap style used on outline ends.
        Specified by:
        setOutlineCap in interface OutlineStyle
        Parameters:
        cap - the line cap type
      • getOutlineCap

        public LineCap getOutlineCap()
        Description copied from interface: OutlineStyle
        Returns the line cap style used on outline ends.
        Specified by:
        getOutlineCap in interface OutlineStyle
        Returns:
        the line cap style
      • cancelActiveEditor

        public static void cancelActiveEditor()
      • customizePopupMenu

        public void customizePopupMenu​(javax.swing.JPopupMenu menu,
                                       PageItem[] selection,
                                       boolean isSelectionFocus)
        Description copied from interface: PageItem
        Allows a page item the opportunity to customize the popup menu before it is displayed. When a popup menu is constructed for a page view, the items in the selection will be offered the opportunity to customize the menu. Generally, only the last item (if any) makes any changes.
        Specified by:
        customizePopupMenu in interface PageItem
        Overrides:
        customizePopupMenu in class AbstractItem
        Parameters:
        menu - the menu that will be displayed
        selection - the selected items; this should be considered read-only
        isSelectionFocus - if true, this is the last item in the selection
      • writeImpl

        protected void writeImpl​(java.io.ObjectOutputStream out)
                          throws java.io.IOException
        Overrides:
        writeImpl in class AbstractRenderedItem
        Throws:
        java.io.IOException
      • readImpl

        protected void readImpl​(java.io.ObjectInputStream in)
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException
        Overrides:
        readImpl in class AbstractRenderedItem
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • isTextJustified

        public boolean isTextJustified()
      • setTextJustified

        public void setTextJustified​(boolean justifyText)