I have a code something like this:
a)First what exactly super.paintComp onent(g) do? I deleted this from my program and still works
b)Is there any difference if i put the super.paintComp onent(g) in line 12 or in line 7 ?It works in both cases.Why?
Thanks
for a) i understand that we call the method paintComponent from the parent class
also i read that in JFrame the paint method (is like paintComponent) is called in order to work good ,example the title of the frame ....
In JPanel what do?
Code:
public class panelPic extends JPanel
{
.......................
protected void paintComponent(Graphics g)
{
//super.paintComponent(g);
g.setColor(Color.RED);
g.drawString ("hello",d.width/2, d.height/2);
...................................
super.paintComponent(g);
}
}
b)Is there any difference if i put the super.paintComp onent(g) in line 12 or in line 7 ?It works in both cases.Why?
Thanks
for a) i understand that we call the method paintComponent from the parent class
also i read that in JFrame the paint method (is like paintComponent) is called in order to work good ,example the title of the frame ....
In JPanel what do?
Comment