Class CustomPaint

  • All Implemented Interfaces:
    PaintInfo

    public class CustomPaint
    extends java.lang.Object
    implements PaintInfo
    This class represents a custom paint that can be displayed on the game screen.
    • Constructor Detail

      • CustomPaint

        public CustomPaint​(PaintInfo paintInfo,
                           PaintLocations location,
                           java.awt.Color[] fontColors,
                           java.lang.String fontName,
                           java.awt.Color[] textBackgroundColors,
                           java.awt.Color[] textBackgroundBorderColors,
                           int borderThickness,
                           boolean singleBackground,
                           int spaceBetweenFields,
                           int horizontalPadding,
                           int verticalPadding)
        Constructor to create the paint, arguments passed define how the paint will appear.
        Parameters:
        paintInfo - The paintInfo object you created, usually this will be the script class that extends PaintInfo. This object allows us to update the paint info for things like script runtime, exp/hr, etc.
        location - The location on the screen in which the paint is to be placed, from the enum defined above.
        fontColors - Array of Color which represents the font colors to use. If the array is longer than the number of Strings in the info array it will be shortened. If it is shorter the last element of the array will be copied until the array is the same length as the number of Strings in the info array.
        fontName - Font name to use to print the text, as a String. This name is checked, and will be replaced if it is unavailable.
        textBackgroundColors - Array of Color which represents the background colors to use. Backgrounds will be drawn behind the text in the paint. If you do not want a background, make the Color completely transparent. If the array is longer than the number of Strings in the info array it will be shortened. If it is shorter the last element of the array will be copied until the array is the same length as the number of Strings in the info array.
        textBackgroundBorderColors - Array of Color which represents the border colors to use. Borders will be drawn around where the background of the text is on the paint. If you do not want a background, make the Color completely transparent. If the array is longer than the number of Strings in the info array it will be shortened. If it is shorter the last element of the array will be copied until the array is the same length as the number of Strings in the info array.
        borderThickness - Thickness of the border to draw. If you do not want a border, make the border thickness 0.
        singleBackground - A boolean, true if you want one background behind all text, false if you want backgrounds drawn individually.
        spaceBetweenFields - The space in pixels to place between the painted Strings. If using multiple backgrounds the space accounts for the backgrounds, and will be the space between where the backgrounds end.
        horizontalPadding - Padding to add horizontally to the printed Strings, measured in pixels. Padding is whitespace, and will create space between the text and edge of background
        verticalPadding - Padding to add vertically to the printed Strings, measured in pixels. Padding is whitespace, and will create space between the text and edge of background
      • CustomPaint

        public CustomPaint()
    • Method Detail

      • makeTransparentColor

        public static java.awt.Color makeTransparentColor​(java.awt.Color baseColor,
                                                          int transparency)
        Returns the base color with the applied transparency.
        Parameters:
        baseColor - Color to make transparent.
        transparency - How transparent to make the color, 100 is completely transparent, 0 is completely opaque.
        Returns:
        Base color with the applied transparency.
      • setFont

        public CustomPaint setFont​(java.lang.String fontName)
      • setBorderThickness

        public CustomPaint setBorderThickness​(int thickness)
      • setFontColors

        public CustomPaint setFontColors​(java.awt.Color... fontColors)
      • setHorizontalPadding

        public CustomPaint setHorizontalPadding​(int horizontalPadding)
      • setVerticalPadding

        public CustomPaint setVerticalPadding​(int verticalPadding)
      • setSingleBackground

        public CustomPaint setSingleBackground​(boolean singleBackground)
      • setBackgroundColors

        public CustomPaint setBackgroundColors​(java.awt.Color... backgroundColors)
      • setBorderColors

        public CustomPaint setBorderColors​(java.awt.Color... borderColors)
      • setSpaceBetweenFields

        public CustomPaint setSpaceBetweenFields​(int pixels)
      • setInfoSupplier

        public CustomPaint setInfoSupplier​(java.util.function.Supplier<java.lang.String[]> infoSupplier)
      • paint

        public void paint​(java.awt.Graphics graphics)
      • paint

        public void paint​(java.awt.Graphics graphics,
                          boolean forceRepaint)
      • getRuntimeString

        public java.lang.String getRuntimeString()
        Returns the time that the current script has ran for. Based off of the start time created when the script starts. Could use the method in the script, but wanted to avoid passing a script object.
        Returns:
        The current runtime of the script as a String.
      • getPaintInfo

        public java.lang.String[] getPaintInfo()
        Specified by:
        getPaintInfo in interface PaintInfo