This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Calculating size-accordance between Main Panel & Child Panel. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Calculating size-accordance between Main Panel & Child Panel." Watch "Calculating size-accordance between Main Panel & Child Panel." New topic
Author

Calculating size-accordance between Main Panel & Child Panel.

ramya narayanan
Ranch Hand

Joined: Oct 06, 2008
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?
Follow me!

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

Joined: Oct 06, 2008
Posts: 338
Any replies?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19656
    
  18

Patience Is A Virtue.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calculating size-accordance between Main Panel & Child Panel.
 
Similar Threads
How to DnD JLabels in left Jpanel to right and vice versa??
A challenge in components layout
Dispalying random dates
Why I cannot Move my JLabel after I add SetToolTipText()??
How can I keep focus on the component pressed until I pressed other component????