Skip to main content

Painting Swing components in the LayerUI

3 replies [Last post]
jacek
Offline
Joined: 2003-08-22
Points: 0

Let's say I want to do this: I want to extend the Busy UI from the demo to display a progress bar with a progress message at the bottom. Also, I would like to show a Cancel button so that the user can abort the current process.

I could just pop up a JDialog to do this of course...but it would be quite fancy to do this directly in the LayerUI...have the animated busy UI indicator , plus some Swing controls at the bottom. And I would probably blur the components within the JXLayer itself for a real nice Flex-like effect.

How would I even go about the approach of adding (or painting manually) Swing components within the current LayerUI?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
alexfromsun
Offline
Joined: 2005-09-05
Points: 0

Hello Jacek

I encourage you to not extend BusyUI from the demo,

but one of the core LayerUI from the org.jdesktop.jxlayer.plaf package

or one of the extras UI from the org.jdesktop.jxlayer.plaf.ext

the demo code are written just for demonstrating purposes, it is very simple

and it is outside jxlayer.jar which means it can be changed at any time

so, extend LockableUI, use BusyPainter if you like,

override setLocked() and add a Cancel button to the layer's glassPane

(don't forget to set proper LayoutManager to it, consider installUI() method for that)

I use this technique to show the mouse scrollable indicator in the MouseScrollableUI

Thanks

alexp

jacek
Offline
Joined: 2003-08-22
Points: 0

Aaah....the Glass pane is the trick, of course. OK, I will explore that avenue. thanks for the tip.

alexfromsun
Offline
Joined: 2005-09-05
Points: 0

By the way, I just updated the LockableDemo,
(also available as zip files on jxlayer.dev.java.net)


the second LayerUI puts the unlock button on the top of the layer,

please use this code as a sample for your own implemenation


Thanks

alexp