I am trying to make a gradient effect on an AWT component using a series of lines drawn on its java.awt.Component.getGraphics() using the java.awt.Graphics.drawLine() method, but this never stays painted. Does anyone know how to commit these graphics to the component so they stay through resizing and other events that invoke repainting?
I am trying to make a gradient effect on an AWT component using a
Share
Are you limited to AWT components? If not I suggest you go with Swing components (the ones starting with “J”. For custom painting you override the
paintComponentmethod, for example: