Class GradientPanel

    • Constructor Detail

      • GradientPanel

        public GradientPanel()
        Creates a new GradientTitlePanel with a gradient from DARK_GREY to LIGHT_GREY. The default title string is set to a one char width whitespace. This results in a correctly calculated preferred size of the title label.
    • Method Detail

      • setGradientColors

        public void setGradientColors​(Color[] gradientColors)
        Sets the colors used as gradient.

        The first color in the array is used as the leftmost color in the gradient.

        Parameters:
        gradientColors - the colors to use as gradient
      • getGradientColors

        public Color[] getGradientColors()
      • paintComponent

        protected void paintComponent​(Graphics g)
        First paints the gradient, and delegates the call to its children.

        Usually you should use components that do not draw their background on their own.

        Overrides:
        paintComponent in class JComponent
        Parameters:
        g - the GraphicsContext to paint on
        See Also:
        JComponent.setOpaque(boolean)