I tried the following example for applying a linear gradient: GradientPaintDemo2D.
It works well, but I wanted the gradient color to be applied into Java Swing matte border. I tried this:
javax.swing.BorderFactory.createMatteBorder(1, 50, 1, 50, color)
But that’s only for applying one type of Color, not GradientPaint.
As we all know, GradientPaint contains two colors mixed altogether, as shown in the example linked above. So what’s the alternative answer for this case?
How about using new MatteBorder(int, int, int, int, javax.swing.Icon)