Article View: borland.public.jbuilder.java.swing
Article #12613Making a ScalingPane...
From: Johan Forsberg
Date: Wed, 02 Dec 1998 00:00
Date: Wed, 02 Dec 1998 00:00
37 lines
1900 bytes
1900 bytes
My company is in the process of recoding all our old VB apps in Java. The major app (member db application) has a very popular feature: the "blow up" option. When this is selected, the window is expanded to fill the screen. Not in the normal fashion, however, but by increasing the size/fontsize of the components. I'm now trying to replicate this in Java, and trying to find a Better Way (TM) to implement this than actually walking through every single component in the window and fiddling with their size. I'm using JDK1.2, Swing lightweight components only. My bright idea was creating a ScalingPane which overrides the paintChilden() method. In this method I change the AffineTransform of the input Graphics2d, do a super.paintChildren() and then change back. The end result is very pretty indeed, and without having to change a single line of code in the rest of the application. Unfortunately there are two problems. 1) In some situations (when clicking in them for instance) subcomponents are repainted directly without going through my paintChildren() method, and so they are redrawn unscaled in their 'real' positions. 2) MouseEvents are passed directly to the subcomponents, even if my Pane is set to receive MouseEvents. I've looked everywhere, but found no way to intercept them. Theese two problems seem to make the use of AffineTransform to scale the window impossible, but it *looked* so pretty I'm loath to dismiss the concept yet. Suggestions/ideas would be very welcome...
Technical Details
Message-ID:
<01be1df7$a2f14100$6bcc79c0@pc4107.stmf.se>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,835f9c1b9550c0fb,start X-Google-Attributes: gid111d45,public From: "Johan Forsberg" <jfo@stmf.se> Subject: Making a ScalingPane... Date: 1998/12/02 Message-ID: <01be1df7$a2f14100$6bcc79c0@pc4107.stmf.se> X-Deja-AN: 417838601 Organization: ST Newsgroups: borland.public.jbuilder.java.swing