Note: the code on this page is targeted at the older JXLayer 3.0. For a version of this page targeted at the new JXLayer 4.0 please go to JXLayer 4.0 demonstration by Piet Blok
This page supersedes two previous blogs about the same subject, JXLayer, a first impression and JXLayer and a generic ZoomUI . Basically, the same demonstrations are shown, but the source code has been restructured considerably.
The code is licensed under the new BSD license. .
| 2009 - 04 - 22 |
The RepaintManager blues continued: for Java versions starting with
Java
6u10,
an attempt is made to use the undocumented
JavaFX RepaintManager delegate facility
for
TransformUI
(thank you Alex, for the hint some time ago. Finally found the time
to pursue that trail).
During class initialization, the method
SwingUtilities3.setDelegateRepaintManager(JComponent,
RepaintManager)
is obtained via reflection.
If this is successful, a flag is set
that the mechanism is available
and can be used.
If not, the existing
mechanism
RepaintManager.setCurrentManager(RepaintManager)
will be used.
As a result, the hack experiments concerning RepaintManagers don't
make much sense anymore when running
Java 6u10 or higher. (But I didn't remove them)
|
| 2009 - 04 - 21 |
|
| 2009 - 04 - 08 |
In TransformPort the
paint()
method is used instead of the
print()
method
for rendering the view to an intermediate image.
This is made
possible by first setting double buffering enabled to
false
on the RepaintManager, do the paint() and finally restoring the
original
flag for double buffering enabled on the RepaintManager.
Thank you Alex for the golden hint!
Removed the option "Paint over Print" because it's no more relevant. |
| 2009 - 04 - 07 |
Upgraded to the latest jxlayer.jar (signed by me, not Alex).
Added an option (for test purposes only) that instructs TransformUI to use paint() instead of print(). In jre 6u14 b02 this should work. However, after testing I see that artifacts are still there. Some restructuring (moved setters and getters for transformation values from the Transformer to the TransformPort). |
| 2009 - 04 - 06 |
Installed SwingX release 0.9.7.
|
| 2009 - 04 - 05 |
Adapted to the planned SwingX release 0.9.7.
(waiting for release
0.9.7 to be available, the continuous build
#1732
is currently used).
Added SwingX demo. Added a demo by s_barlow. Added a mirror function. Fixed some minor bugs. |
| 2009 - 02 - 12 | Added a license. |
| 2009 - 02 - 12 | The mouse event re dispatching mechanism now re dispatches to the first component upwards in the hierarchy that actually has the appropriate listener registered. |
| 2009 - 02 - 12 |
Added a feature to the
Transformer
class that enables
one to have the view always scaled to the
preferred scale,
regardless of its actual size. This feature is used
in the new
"Vertical table headers" demo.
|
| 2009 - 02 - 10 | The Transformer didn't detect changes in the view's size, thus causing artifacts when adding or removing child components. |
| 2009 - 02 - 10 | Under construction: Added some "under construction" packages that contain code for possible future use. When they mature, they may be added to official packages. |
Various transformations, like scaling (zooming), rotation (in radians and / or in quadrants) and shearing are possible on a component hierarchy.
Note: on the control dialog only one tool tip is set on the glass pane over the controls.
The following
LayerUI
s are demonstrated:
| TransformUI |
With its companion class
DefaultTransformModel
a component hierarchy can be transformed (rotation, shearing and
scaling).
|
|---|---|
| MouseEventUI | Mouse events are dispatched to the intended child component, even when the glass pane is a target for those events. |
Press the "RPM tree" button on the control dialog to see the current RepaintManager delegate sequence.
The TransformUI demo with the RepaintManager hack enabled:
A modified (hacked) version of Alexander Potochkin's demo that
illustrates
the RepaintManager problem and the hacked solution:
Tool tips are shown via the TransformUI on text components that are
deliberately
rendered with a very tiny font. The tool tip uses the
Document
content of those components
and renders it enlarged.
The following
LayerUI
s are demonstrated:
| TransformUI | This time used on a tool tip component. |
|---|
A JTable is shown with vertical table headers.
The following
LayerUI
s are demonstrated:
| TransformUI |
Used in a TableCellRenderer.
Only a quadrant rotation is used, with
the new feature
Transformer.setScaleToPreferredSize(true)
.
|
|---|
Nested JXPanels with JXBusyLabels are shown. The main purpose of this demonstration is to show the cooperation of SwingX's RepaintManagerX with the TransformRepaintManager.
When moving the mouse over a JXBusyLabel, the alpha value of its parent JXPanel is set higher, thus forcing setting of a RepaintManager.
Press the "RPM tree" button on the control dialog to see the current RepaintManager delegate sequence.
A structure where three
LayerUI
s are wrapped on one target component.
The following
LayerUI
s are demonstrated:
| HideCursorUI | After a specified interval, the mouse cursor disappears, to reappear on any mouse movement. |
|---|---|
| MouseDrawingUI | Lines will be drawn over the component, triggered by mouse dragging. |
| MagnifierUI | A magnifier glass is shown over the component. |
Basically the same as the wrapping demo, but this time the
LayerUI
s
are shared on two structures.
The following
LayerUI
s are demonstrated:
| HideCursorUI | After a specified interval, the mouse cursor disappears, to reappear on any mouse movement. |
|---|---|
| MouseDrawingUI | Lines will be drawn over the component, triggered by mouse dragging. |
| MagnifierUI | A magnifier glass is shown over the component. |
JXLayer is a tool developed by Alexander Potochkin , also known as alexp or alexfromsun .
This is the JXLayer project .
This is the JXLayer forum .
Author:
Piet Blok.
If you wish to contact me, please send email to