How to center a multiline Label inside a RoundedRectangle? [message #221185] |
Thu, 10 August 2006 11:42 |
Eclipse User |
|
|
|
Originally posted by: am.andreasmeissner.de
Hi,
since I'm developing with Eclipse 3.2 and the corresponding GEF 3.2
releases I get the following problem. My multiline label inside a
RoundedRectangle isn't centered anymore. The horizontal centering works
fine but not the vertical one. It's now places vertically on the top of
the rectangle.
Does anyone of you see a problem in my code or has some hints?
public class LabeledRoundedRectangle extends RoundedRectangle {
public LabeledRoundedRectangle() {
setLayoutManager(new BorderLayout());
TextFlow textFlow = new TextFlow();
textFlow.setText("some text");
FlowPage flowPage = new FlowPage();
flowPage.setHorizontalAligment(PositionConstants.CENTER);
flowPage.add(textFlow);
add(flowPage, BorderLayout.CENTER);
}
...
}
Thanks,
Andreas
|
|
|
Re: How to center a multiline Label inside a RoundedRectangle? [message #221199 is a reply to message #221185] |
Thu, 10 August 2006 15:48 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
BorderLayout was changed in 3.2 so that the center figure is stretched to
fill the available space. This was to make it consistent with expectations
(AWT), and because of use cases which suggested this was a better default.
So now your flowpage is no longer centered in the middle of its parent.
It's obvious what you need to do but there's no quick fix.
"Andreas Meissner" <am@andreasmeissner.de> wrote in message
news:ebf63g$962$1@utils.eclipse.org...
> Hi,
>
> since I'm developing with Eclipse 3.2 and the corresponding GEF 3.2
> releases I get the following problem. My multiline label inside a
> RoundedRectangle isn't centered anymore. The horizontal centering works
> fine but not the vertical one. It's now places vertically on the top of
> the rectangle.
>
> Does anyone of you see a problem in my code or has some hints?
>
>
> public class LabeledRoundedRectangle extends RoundedRectangle {
>
> public LabeledRoundedRectangle() {
> setLayoutManager(new BorderLayout());
> TextFlow textFlow = new TextFlow();
> textFlow.setText("some text");
> FlowPage flowPage = new FlowPage();
> flowPage.setHorizontalAligment(PositionConstants.CENTER);
> flowPage.add(textFlow);
> add(flowPage, BorderLayout.CENTER);
> }
> ...
> }
>
> Thanks,
> Andreas
|
|
|
Powered by
FUDForum. Page generated in 0.04448 seconds