tags:

views:

56

answers:

0

I'm trying to horizontally and vertically center two lines of text inside a Rectangle figure in Draw2D. The following code centers the text horizontally but not vertically:

IFigure figure;
figure = new Rectangle();

FlowPage flowPage = new FlowPage();
flowPage.setHorizontalAligment(PositionConstants.CENTER);

textFlow = new TextFlow();
textFlow.setLayoutManager(new ParagraphTextLayout(textFlow,
                      ParagraphTextLayout.WORD_WRAP_SOFT));

textFlow.setText("Line 1\nLine2");

flowPage.add(textFlow);

figure.setLayoutManager(new BorderLayout());
figure.add(flowPage, BorderLayout.CENTER);

Any ideas?