Class Label


  • public class Label
    extends greenfoot.Actor
    A Label class that allows you to display a textual value on screen. The Label is an actor, so you will need to create it, and then add it to the world in Greenfoot. If you keep a reference to the Label then you can change the text it displays.
    Version:
    1.1
    Author:
    Amjad Altadmri
    • Constructor Summary

      Constructors 
      Constructor Description
      Label​(int value, int fontSize)
      Create a new label, initialise it with the int value to be shown and the font size
      Label​(java.lang.String value, int fontSize)
      Create a new label, initialise it with the needed text and the font size
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void setFillColor​(greenfoot.Color fillColor)
      Sets the fill color of the text
      void setLineColor​(greenfoot.Color lineColor)
      Sets the line color of the text
      void setValue​(int value)
      Sets the value as integer
      void setValue​(java.lang.String value)
      Sets the value as text
      • Methods inherited from class greenfoot.Actor

        act, addedToWorld, getImage, getIntersectingObjects, getNeighbours, getObjectsAtOffset, getObjectsInRange, getOneIntersectingObject, getOneObjectAtOffset, getRotation, getWorld, getWorldOfType, getX, getY, intersects, isAtEdge, isTouching, move, removeTouching, setImage, setImage, setLocation, setRotation, turn, turnTowards
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Label

        public Label​(int value,
                     int fontSize)
        Create a new label, initialise it with the int value to be shown and the font size
      • Label

        public Label​(java.lang.String value,
                     int fontSize)
        Create a new label, initialise it with the needed text and the font size
    • Method Detail

      • setValue

        public void setValue​(java.lang.String value)
        Sets the value as text
        Parameters:
        value - the text to be show
      • setValue

        public void setValue​(int value)
        Sets the value as integer
        Parameters:
        value - the value to be show
      • setLineColor

        public void setLineColor​(greenfoot.Color lineColor)
        Sets the line color of the text
        Parameters:
        lineColor - the line color of the text
      • setFillColor

        public void setFillColor​(greenfoot.Color fillColor)
        Sets the fill color of the text
        Parameters:
        fillColor - the fill color of the text