I\'ve a class which extends JPanel. I overwrote protected void paintComponent(Graphics g).
JPanel
protected void paintComponent(Graphics g)
There is a variable which has to be recalculate
If I understand the question correctly then you should read the section from the Swing tutorial on How to Write a Component Listener which shows you how to listen for a change in a components size.