Issue with use of StackPane, Label, and ScaleDecorator

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Issue with use of StackPane, Label, and ScaleDecorator

Erik Innocent
To Roger, thanks for your help with my issue with Label positioning with StackPane. But now i'm having an issue with scaling and how it affects positioning. 

The problem is that as I scale down a Label with ScaleDecorator when using StackPane, the Label moves toward the center of the display. I've provided a test case at:


Is this correct behavior? I was expecting the label to remain in the same place. Note that even when I do a Label.setLocation(), it has no effect (uncomment the line in Runnable.run() to see this).

What can do I to make the Label remain at its origin?

I genuinely appreciate your time in looking into this, and I thank you again.
--E

PS -- Marek Repak, you can remove yourself from this list by sending an email to [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with use of StackPane, Label, and ScaleDecorator

cbartlett
Erik.

What is it you are trying to achieve with the ScaleDecorator?  I think the 'issue' stems from the use of StackPane, but without knowing what you are aiming for it is hard to know if it *is* and issue :)  I looked at your previous question and wonder if using a Panel inside of the StackPane might help. 

Anyway...

You can add a ShadeDecorator to the label in your example to highlight its bounds and visualize what is currently happening.  This shows that the label is normally the size of the StackPane before ScaleDecorator shrinks it.
label.getDecorators().add(new ShadeDecorator(0.3f, Color.GREEN)); // ShadeDecorator

ScaleDecorator has properties to control vertical and horizontal alignment, both of which default to 'CENTER'

You can change these and rerun your example to see that the text no longer appears to be pushed into the center of the window.
final ScaleDecorator sd = new ScaleDecorator();
sd.setHorizontalAlignment(HorizontalAlignment.LEFT);
sd.setVerticalAlignment(VerticalAlignment.TOP);

Chris



On 25 July 2013 00:40, Erik Innocent <[hidden email]> wrote:
To Roger, thanks for your help with my issue with Label positioning with StackPane. But now i'm having an issue with scaling and how it affects positioning. 

The problem is that as I scale down a Label with ScaleDecorator when using StackPane, the Label moves toward the center of the display. I've provided a test case at:


Is this correct behavior? I was expecting the label to remain in the same place. Note that even when I do a Label.setLocation(), it has no effect (uncomment the line in Runnable.run() to see this).

What can do I to make the Label remain at its origin?

I genuinely appreciate your time in looking into this, and I thank you again.
--E

PS -- Marek Repak, you can remove yourself from this list by sending an email to [hidden email]


Loading...