• Post Reply Bookmark Topic Watch Topic
  • New Topic

a question about JPanel  RSS feed

 
alan fisher
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class FontPanel extends JPanel
{
public void paintComponent(Graphics g)
{
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
\\...
}
}
when we extend JPanel,what's super.paintComponent(g) do in method paintComponent?Is it a necessrity?
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually u don't need that, if u just want to extend the JPanel... but if u want to get some components painted by your superclass, that would be needed...
What I mean is if u simply want to extend the JPanel, u do not need that method... Hope u r clear...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!