Skip to main content

Using JXLayer to put another layer on top of a JPanel?

1 reply [Last post]
Joined: 2008-07-31


I'm very excited to use JXLayer. I just started using it and getting into it.

Now I'm wondering whether the following scenario can be accomplished using JXLayer:

I've a JPanel with lots of custom painting in it. I would like to use some stuff from JHotDraw to "annotate" some of my paintings using a text and an arrow to mark the point of interest.

My 1st thought was to use JXLayer to "lock" my custom painting (yes, you can "edit" the painting as well :-)) and somehow draw the JHotDraw stuff inside the JXLayer.

One problem is, I need to use JHotDraw in an editing mode to create new text labels and arrows and to arrange them as desired. This should happen when my custom painting is locked.

On the other hand, I need to "just" paint the JHotDraw stuff on top of my custom painting in normal mode.

Is it possible to accomplish this task using JXLayer? Does anyone have a general hint to get this done?

Thanks 4 your work, Alex.
I'd like to use JXLayer more in the future and clean up some of my own work to achieve similar effects :-).

Reply viewing options

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

Hello Harax

I have no idea what JHotDraw is, however you certainly can paint whatever you want
on top of the components inside JXLayer, just make your own AbstractLayerUI and override paintLayer() method