Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to center a multiline Label inside a RoundedRectangle?
How to center a multiline Label inside a RoundedRectangle? [message #221185] Thu, 10 August 2006 11:42 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
Previous Topic:EContentAdapter behaviour ?
Next Topic:Multiple Property Change Commands w/ EMF.Edit
Goto Forum:
  


Current Time: Fri Nov 28 04:46:11 GMT 2014

Powered by FUDForum. Page generated in 0.01594 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software