do some painting here, but how do I do it without being in paintcomponent. i simply wanted to give this custom jbutton a different gradient.
I was always told that if you painting buttons or smaller components then call paintcomponent at the end, but if your painting panels or frames to call it at the beginning.
For components with a UI Delegate, you should pass the Graphics parameter with the line super.paintComponent(g) as the first line of code in your paintComponent override. If you do not, then your component will be responsible for manually painting its background.
If your custom component extends JPanel or a more specialized JComponent descendant, then you can paint the background by invoking super.paintComponent before painting the contents of your component.
You'll never get away with this you overconfident blob! The most you will ever get is this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton