| Author |
Using GradientPaint and Swing Components
|
John Macek
Greenhorn
Joined: Feb 26, 2002
Posts: 2
|
|
Is there is any way to use GradientPaint to have my swing components with a gradiated background? I want to have a Jpanel that shades from one color to another from top to bottom. I am using the JPanel in an extension of the JDialog class. I have tried overriding the paint method in my extension of JDialog and calling Graphics2D's setPaint method to use a GradientPaint. I have also tried calling the JPanel's getGraphics method and using setPaint on that. None of this has made any difference. The runtime class of each Graphics is SunGraphics2D. I have been unable to find source code for this class. Any help would be greatly appreciated. Thanks, John
|
 |
Nathan Pruett
Bartender
Joined: Oct 18, 2000
Posts: 4121
|
|
Here's some example code I made for a JPanel that has a GradientPaint background... Hopefully this helps you out... -Nate
|
-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
|
 |
John Macek
Greenhorn
Joined: Feb 26, 2002
Posts: 2
|
|
|
That's pretty much what I did. Thanks.
|
 |
 |
|
|
subject: Using GradientPaint and Swing Components
|
|
|