I know that i had similar problem recently and i should to do it yourself but i tried many times and I was looking for solution without success.
I know that is possibility to add various graphics for different state: pressed etc. but i want to create button not only in the shape of a Rectangle or Square. I just want to more graphics control for my swing components.
Method paint is invoked but the Rectangle is not drawn. The Graphics is not displayed but if i change something for parameters component for example
You probably just can't see the drawn rectangle. Maybe you meant to fillRect(...) instead?
And when you get that sorted out, you'll still have a button sans text and icon, without focus or pressed decoration. Are you sure what you want can't be achieved by setting the values contained in Button.gradient in the UIManager?
Joined: Jun 08, 2011
I changed coord. and instead of draw i used fill and now works. I see that i could used UIManager to get the same effect.
I wonder if there is any possibility to add custom shape to button. For example circle. If i draw circle using MetalButtonUI he will be inside the square or rectangle. Maybe i paste image to be more specific.