How to center Label vertical and horizontal in draw2d Figure ?

Posted by aphex on Stack Overflow See other posts from Stack Overflow or by aphex
Published on 2010-04-16T10:00:19Z Indexed on 2010/04/16 10:03 UTC
Read the original article Hit count: 400

Filed under:
|
|
|

I have the following situation:

Label label = new Label();
label.setText("bla");
RoundedRectangle fig = new RoundedRectangle();
fig.add(label);
FlowLayout layout = new FlowLayout();
layout.setStretchMinorAxis(true);
fig.setLayoutManager(layout);
fig.setOpaque(true);

That works only to center the label vertical or horizontal by using layout.setHorizontal(true/false); , but not together. Any idea how to make it work ?

© Stack Overflow or respective owner

Related posts about draw2d

Related posts about figure