# Calculating size-accordance between Main Panel & Child Panel.

ramya narayanan
Ranch Hand
Posts: 338
Ever-helping ranchers,
I've got a doubt on calculating window-size-ratio's accordance between panels.
I want to know generally how will they implement this or any useful links or tutorials on this.

I will try to picturise the scenario before you!

Consider there are two Windows Main Window & Child Window
Both of these windows extends Panel class

We need to calculate window-size ratio's between these Main Panel & Child Panel!
Why?

Main Panels features
1) These main panel is used to represent some time-duration say 10 min or 20 min. It is represented numerically .
But at any point of time the main panel will display 10 time-durations. If we scroll also, it will display 10 time-durations.
2) It has a vertical & horizontal scroll bar to scroll through these time-durations.
3) These main panel implements adjustmentlistener

Child Panel features
1) These child panel represents the main window components i.e. time-duration in rectangular bars.
2) It also has another broader white-color rectangle, which is used to move over these bars whose height we need to calculate. (rectheight)
Generally the 10 time-durations at any time in main panel, should be represented in Child Panel by covering those bars with these white-color rectangle.

Here p.x --> Point.x
p.y ---> Point.y

So now comes the crux of my question.
My child panel has a reference to the main panel, through which it can call the main panel's adjustment-listener's methods.
1) When we vertically scroll the time-duration in Main Window , (say at that time 5-15 time-duration representation) , the corresponding 10 time-durations in ChildPanel (which are represented in bars) should get highlighted in white-color rectangle(which moves over all the bars).

2) Also when I'm moving my white-color-rectangle over the bars in child panel, the corresponding time-duration only should get highlighted(should come in main window) in main panel.

For this size-accordance should be calculated between main panel & child panel right?
How that can be done!

I want to know generally how will they do this or atleast some idea or links is suffice!

My Best Regards!

ramya narayanan
Ranch Hand
Posts: 338
Any replies?

Rob Spoor
Sheriff
Posts: 20661
65