Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Maintaining aspect ratio (solved)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Maintaining aspect ratio (solved)



One way to do it:

1. Create a JPanel with flow layout aligned left
2. Create a subclass of JPanel (MyAspectPanel) that has as a data member the QTComponent your movie will create. Set the layout of MyAspectPanel to GridBagLayout
3. Add MyAspectPanel to the JPanel in step 1
4. When opening a movie, after creating the QTComponent, create GridBagConstraints like:


GridBagConstraints mGridConstraints = new GridBagConstraints();
mGridConstraints.fill = GridBagConstraints.BOTH;
mGridConstraints.weightx = mGridConstraints.weighty = 1.0;
mGridConstraints.insets = new Insets(0, 0, 5, 5);
mGridBag.setConstraints(myQTComponent.asComponent(), mGridConstraints);

5. Add the QTComponent's AWT representation to MyAspectPanel
6. Override getPreferredSize in MyAspectPanel. Get the height and width of MyAspectPanel's parent and use that to resize your QTComponent as appropriate.


This worked quite well for me; hope it helps someone else.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-java mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.