Class Caret

    • Constructor Summary

      Constructors 
      Constructor Description
      Caret​(Canvas parent, int style)
      Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.
    • Constructor Detail

      • Caret

        public Caret​(Canvas parent,
                     int style)
        Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

        The style value is either one of the style constants defined in class SWT which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using the int "|" operator) two or more of those SWT style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.

        Parameters:
        parent - a composite control which will be the parent of the new instance (cannot be null)
        style - the style of control to construct
        Throws:
        IllegalArgumentException -
        • ERROR_NULL_ARGUMENT - if the parent is null
        SWTException -
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
        • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
        See Also:
        SWT, Widget.checkSubclass(), Widget.getStyle()
    • Method Detail

      • getBounds

        public Rectangle getBounds()
        Returns a rectangle describing the receiver's size and location relative to its parent (or its display if its parent is null).
        Returns:
        the receiver's bounding rectangle
        Throws:
        SWTException -
        • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • getFont

        public Font getFont()
        Returns the font that the receiver will use to paint textual information.
        Returns:
        the receiver's font
        Throws:
        SWTException -
        • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • getImage

        public Image getImage()
        Returns the image that the receiver will use to paint the caret.
        Returns:
        the receiver's image
        Throws:
        SWTException -
        • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • getLocation

        public Point getLocation()
        Returns a point describing the receiver's location relative to its parent (or its display if its parent is null).
        Returns:
        the receiver's location
        Throws:
        SWTException -
        • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • getParent

        public Canvas getParent()
        Returns the receiver's parent, which must be a Canvas.
        Returns:
        the receiver's parent
        Throws:
        SWTException -
        • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • getSize

        public Point getSize()
        Returns a point describing the receiver's size.
        Returns:
        the receiver's size
        Throws:
        SWTException -
        • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • getVisible

        public boolean getVisible()
        Returns true if the receiver is visible, and false otherwise.

        If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, this method may still indicate that it is considered visible even though it may not actually be showing.

        Returns:
        the receiver's visibility state
        Throws:
        SWTException -
        • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • isVisible

        public boolean isVisible()
        Returns true if the receiver is visible and all of the receiver's ancestors are visible and false otherwise.
        Returns:
        the receiver's visibility state
        Throws:
        SWTException -
        • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
        See Also:
        getVisible()
      • setBounds

        public void setBounds​(int x,
                              int y,
                              int width,
                              int height)
        Sets the receiver's size and location to the rectangular area specified by the arguments. The x and y arguments are relative to the receiver's parent (or its display if its parent is null).
        Parameters:
        x - the new x coordinate for the receiver
        y - the new y coordinate for the receiver
        width - the new width for the receiver
        height - the new height for the receiver
        Throws:
        SWTException -
        • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • setBounds

        public void setBounds​(Rectangle rect)
        Sets the receiver's size and location to the rectangular area specified by the argument. The x and y fields of the rectangle are relative to the receiver's parent (or its display if its parent is null).
        Parameters:
        rect - the new bounds for the receiver
        Throws:
        SWTException -
        • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • setFont

        public void setFont​(Font font)
        Sets the font that the receiver will use to paint textual information to the font specified by the argument, or to the default font for that kind of control if the argument is null.
        Parameters:
        font - the new font (or null)
        Throws:
        IllegalArgumentException -
        • ERROR_INVALID_ARGUMENT - if the font has been disposed
        SWTException -
        • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • setImage

        public void setImage​(Image image)
        Sets the image that the receiver will use to paint the caret to the image specified by the argument, or to the default which is a filled rectangle if the argument is null
        Parameters:
        image - the new image (or null)
        Throws:
        IllegalArgumentException -
        • ERROR_INVALID_ARGUMENT - if the image has been disposed
        SWTException -
        • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • setLocation

        public void setLocation​(int x,
                                int y)
        Sets the receiver's location to the point specified by the arguments which are relative to the receiver's parent (or its display if its parent is null).
        Parameters:
        x - the new x coordinate for the receiver
        y - the new y coordinate for the receiver
        Throws:
        SWTException -
        • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • setLocation

        public void setLocation​(Point location)
        Sets the receiver's location to the point specified by the argument which is relative to the receiver's parent (or its display if its parent is null).
        Parameters:
        location - the new location for the receiver
        Throws:
        SWTException -
        • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • setSize

        public void setSize​(int width,
                            int height)
        Sets the receiver's size to the point specified by the arguments.
        Parameters:
        width - the new width for the receiver
        height - the new height for the receiver
        Throws:
        SWTException -
        • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • setSize

        public void setSize​(Point size)
        Sets the receiver's size to the point specified by the argument.
        Parameters:
        size - the new extent for the receiver
        Throws:
        IllegalArgumentException -
        • ERROR_NULL_ARGUMENT - if the point is null
        SWTException -
        • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • setVisible

        public void setVisible​(boolean visible)
        Marks the receiver as visible if the argument is true, and marks it invisible otherwise.

        If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, marking it visible may not actually cause it to be displayed.

        Parameters:
        visible - the new visibility state
        Throws:
        SWTException -
        • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver