• Post Reply Bookmark Topic Watch Topic
  • New Topic

paint or paintComponent method

 
Serghei Jelauc
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all.
If I want to create my own component (MyButton for example), I have to extend JButton class. I want to create round button for example. Which method I must override in class JButton: paint(Graphics g) or paintComponent(Graphics g)?
Thanks in advance.
 
Fuqiang Zhao
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
overide the methd:
paintComponent(Graphics g)
and set the border to null
setBorder(null)
 
Serghei Jelauc
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!