Package breadboards

Class GLabel

  • All Implemented Interfaces:
    Drawable

    public class GLabel
    extends GObject
    Subclass of GObject used for displaying ovals
    Author:
    paul oser
    • Constructor Detail

      • GLabel

        public GLabel​(java.lang.String text)
        constructs a GLabel with specified text with lower left corner at (0,0)
        Parameters:
        text - the specified text
      • GLabel

        public GLabel​(double x,
                      double y,
                      java.lang.String text)
        constructs a GLabel with a specified text at a specified location
        Parameters:
        x - the x-coordinate of the lower left corner of the GLabel
        y - the y-coordinate of the lower left corner of the GLabel
        text - the specified text
    • Method Detail

      • getText

        public java.lang.String getText()
        returns the text of this GLabel as a string
        Returns:
        the text of this GLabel
      • getBounds

        public GRectangle getBounds()
        returns an empty bounding rectangle for this GLabel
        Specified by:
        getBounds in class GObject
        Returns:
        an empty bounding rectangle for this GLabel
      • getColor

        public java.awt.Color getColor()
        returns the border color of this GLabel
        Returns:
        the border color of this GLabel
      • getHeight

        public double getHeight()
        returns the height of this GLabel
        Returns:
        the height of this GLabel
      • getWidth

        public double getWidth()
        returns the width of this GLabel
        Returns:
        the width of this GLabel
      • setText

        public void setText​(java.lang.String text)
        sets the text of this GLabel
        Parameters:
        text - the new text for this GLabel
      • setFontSize

        public void setFontSize​(int fontSize)
        sets the font size of the GLabel
        Parameters:
        fontSize - the specified font size
      • setFont

        public void setFont​(java.lang.String font)
        sets the font of the GLabel
        Parameters:
        font - a string representing the font (like "TimesRoman")
      • setColor

        public void setColor​(java.awt.Color color)
        sets the border color of the GLabel to the specified color
        Parameters:
        color - the specified color
      • draw

        public void draw​(java.awt.Graphics g)
        draws the GLabel (generally not called directly)
      • contains

        public boolean contains​(double x,
                                double y)
        returns true if (x,y) is inside this GLabel
        Specified by:
        contains in class GObject
        Parameters:
        x - the x-coordinate of the point in question
        y - the y-coordinate of the point in question
        Returns:
        true if (x,y) is inside this GLabel, false otherwise