I am referring to instances of org.apache.pivot.wtk.media.drawing.Rectangle. I probably started down the wrong path trying to get the z-index of the object...I should just paint the objects in the order they should actually appear.
That brings me to another problem to solve, though. It doesn't look like I can make a Button transparent, and what I'm attempting to do is draw a set of shapes and trigger an action when the shape is clicked. My first thought was to use a ComponentMouseButtonListener and then use the pane's getComponentAt(x,y) argument, but that returns components, and while I see how to get the components parent, I don't see how to get back down to the rectangle that the user actually clicked. Would it make more sense for me to create filled borders instead of drawing rectangles? That seems like it would work with rectangular objects, but not other shapes. The Canvas, Rectangle, and ImageView listeners don't look like they have any kind of mouse button listeners available. From: Greg Brown [mailto:[email protected]] Sent: Wednesday, February 24, 2010 8:29 AM To: [email protected] Subject: Re: Stack Panes and Z-Position Is there a simple way to get and set the z position of elements inside a stack pane outside of the order in which they are painted? I'm not sure I understand the question. By definition, the z-index *is* the order in which components are painted. For example, if I were to loop through an array of items to draw (specifically Rectangles in this case) that may or may not be ordered in the array, and I want element 2 to end up on top of element 3...is there a way to do this outside of repainting element 2 after all the objects have been created? How are you planning to draw the rectangles? Are you talking about instances of org.apache.pivot.wtk.media.drawing.Rectangle, or something else?
