2 questions ( semicolon after empty methods and paint()/paintComponent())

1. Is there any difference writing:

publicvoid mouseEntered(MouseEvent e){};

publicvoid mouseMoved(MouseEvent e){};

publicvoid mouseClicked(MouseEvent e){};

publicvoid mouseExited(MouseEvent e){};

than

publicvoid mouseEntered(MouseEvent e){}

publicvoid mouseMoved(MouseEvent e){}

publicvoid mouseClicked(MouseEvent e){}

publicvoid mouseExited(MouseEvent e){}

2.

I have a JPanel which I change the graphical look of very often in my application.

What's the difference if I override paint() or paintComponent() in my JPanel?

[1570 byte] By [CbbLea] at [2007-11-26 22:40:57]
# 1
no difference at all. the semicolon is just ignored by the compiler, as it's totally spurious. there's a rule about always override paint, never paintComponent, or it may well be the other way round. I don't really do Swing. someone else will know, especially in the Swing forum
georgemca at 2007-7-10 11:55:16 > top of Java-index,Java Essentials,Java Programming...
# 2
You should generally override paintComponent(), not paint(). Try reading through this tutorial. http://java.sun.com/docs/books/tutorial/uiswing/painting/index.html
CaptainMorgan08a at 2007-7-10 11:55:16 > top of Java-index,Java Essentials,Java Programming...
# 3
cheers captain. I just knew I had it the wrong way round
georgemca at 2007-7-10 11:55:16 > top of Java-index,Java Essentials,Java Programming...
# 4
thanks! :)
CbbLea at 2007-7-10 11:55:16 > top of Java-index,Java Essentials,Java Programming...