Package breadboards

Class GDieImage

  • All Implemented Interfaces:
    Drawable

    public class GDieImage
    extends GImage
    Subclass of GImage that displays as a die face showing a particular value
    Author:
    paul oser
    • Field Detail

      • DIE_HEIGHT

        public static final int DIE_HEIGHT
        The height of the die image displayed
        See Also:
        Constant Field Values
      • DIE_WIDTH

        public static final int DIE_WIDTH
        The width of the die image displayed
        See Also:
        Constant Field Values
      • NUM_FACES

        public static final int NUM_FACES
        The number of faces associated with the die (a standard die has 6 faces)
        See Also:
        Constant Field Values
    • Constructor Detail

      • GDieImage

        public GDieImage​(int value)
        Create a new die image, that displays the given value on its face, and is positioned at (0,0)
        Parameters:
        value - the value to be displayed on the die face
        Throws:
        java.lang.RuntimeException - when value is not between 1 and NUM_FACES==6
      • GDieImage

        public GDieImage​(int value,
                         double x,
                         double y)
        Create a new die image, that displays the given value on its face, and is positioned at (x,y)
        Parameters:
        value - the value to be displayed on the die face
        x - the x-coordinate of the upper left corner of the die face image
        y - the y-coordinate of the upper left corner of the die face image
        Throws:
        java.lang.RuntimeException - when value is not between 1 and NUM_FACES==6
    • Method Detail

      • displayValue

        public void displayValue​(int value)
        change the image of this die to show a particular value
        Parameters:
        value - the value to be displayed on the die face
        Throws:
        java.lang.RuntimeException - when value is not between 1 and NUM_FACES==6