Reputation: 23
I am trying to create a mancala game board. For the purpose of the game, is there any way I can create a JButton and then just paint on it? I don't want to use setIcon property
Upvotes: 0
Views: 262
Reputation: 347184
You need to create a custom class which extends from JButton
and then override it's paintComponent
method
See Performing Custom Painting, Painting in AWT and Swing and 2D Graphics for more details
Remember though, a button typically has a lot going on, borders, content etc, this makes performing custom painting on them a little more tricky..
Upvotes: 1