tags:

views:

82

answers:

2

Hi,

I am working on an app which when used for loading a file and drawing the contained components, may result into painting of overlapping components. For example, consider a big rectangle box containing text line inside it. Now because these components are overlapping, it is difficult for the user to select the inner text box in this case as it has been overlapped by the rectangle box.

We were thinking of solving this with allowing the users to actually move any component to a layer below the current one. But this has its own limitations on the usability side, as then for every such case the user will have to move the bigger or the most recently painted component to a layer below and then do the other processing on the inner components like dragging etc. There can be more than 2 components at the same 2d (x & y position) in this app.

I am sure that there should be a better solution for this and could someone please provide some pointers on the implemention part of it.

+1  A: 

I am not sure, whether i understand your question. Do you have problems, with the action listeners or because of drawing the components?

This How to Use Root Panes may be helps.

You can create a Glasspane in Java

alt text

alt text

Markus Lausberg
A: 

Here's a simple example of an object drawing program that supports click and drag for multiple selections. More advanced programs often implement z-order functionality (Move Forward, Move Backward, Move to Front, Move to Back) by simply re-ordering the node list.

As an alternative to the layered pane approach, also consider JInternalFrame. This example shows How to Use Actions to manage a menu from which hidden windows may be brought to the fore.

trashgod