Dear Maneesh,
First of all I thank you for sharing your valuable expertise & understanding at this time.
You are almost there.
Instead if hard coding the values (210), pick out the width of the panel at runtime by calling getWidth() in your paint method.
So now this is my updated paint() method.
So after this, whenever I maximize or drag the window size, the width of the bar gets adjusted. That's part of my requirement & I thank you maneesh for this.
But still three challenges are there to surmount:
1) When I increase or decrease the width(by clicking & dragging the window right hand side), the width of the bar is re-sized properly.
But when I increase or decrease the height(by clicking & dragging the window up), the width of the bar is not re-sizing.
2)The line along which the bar is positioned
In my case I'm a painting a rectangle bar along a line(using g.drawLine) inside the panel....
is not re-sizing when i resize the window. I mean I'm not able to find the end of the line when I re-size the window & I need to manually once again drag down the window to see other bars & end of this line.
Suppose when I reduce the size of the panel, by dragging up the window, this line & other bars are not aligning to the new size whereas the width is getting reduced.
3) I've a navigation rectangle which is white in color , which is used to cloud over the bars so as to help in navigation.
The code for which is written inside paint() method itself.
Consider there are some 12 bars totally. These navigation-rectangle will be implemented to cloud or cover over 6 bars at any time.
So when we are re-sizing ,the size of these navigation-rectangle should also change & they should be clouding or covering over the bars, which is not happening under current circumstances
As usual, eagerly looking forward for your valuable piece of information in harnessing this challenge.
MyBestRegards