Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / April 2004

Tip: Looking for answers? Try searching our database.

zoomable JPanel which can take JComponents (with full mouse support)?

Thread view: 
Will Billingsley - 06 Apr 2004 16:47 GMT
[reposted here - earlier incorrectly posted to comp.lang.java.help]

Anyone know a way of allowing a JPanel to be zoomable not only in terms of
how it draws itself, but also so any JComponents within the (zoomed) panel
behave correctly?  

In particular, anyone know a clean way of avoiding these two problems -

1. The JRE's mouse system looking in the untransformed co-ordinate space:
From what I can see, the code the JRE calls
Java.awt.Container.findComponent(int, int, boolean) to find the component
under the mouse to deliver a mouse click event to.  This method is final,
and so can't be overridden to make it look in the transformed coordinate
space.  (This means that where you need to click to click on a button isn't
always where the button appears to be.)

2. not all paint calls seem to come through the component hierarchy.  Eg, if
a JComponent calls setBackground(java.awt.Color.blue), a repaint call seems
to happen directly on the JComponent, and the zoomable JPanel does not get
a chance to apply the transform to the Graphics2D object.  (This means a
component will sometimes suddenly draw itself in the untransformed space,
making it appear in a different place and size on the screen)

cheers,

Will Billingsley
Mr.Cube - 06 Apr 2004 21:03 GMT
> [reposted here - earlier incorrectly posted to comp.lang.java.help]
>
> Anyone know a way of allowing a JPanel to be zoomable not only in terms of
> how it draws itself, but also so any JComponents within the (zoomed) panel
> behave correctly?  

Take a look at the jazz toolkit.
It is a zui (zoomable user interface) which can embed swing components.
(jazz is the predecessor of piccolo which helas doesn't have zoomable
swing components yet).
It's opensource and you can find it at :
http://www.cs.umd.edu/hcil/jazz/

Kees.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.