2

Echo 2 フレームワークは初めてです。シンプルにすべきだと思いますが、生成されたコンテンツを水平方向と垂直方向の中央に配置する方法が見つかりませんでした。幅と高さが固定された中央の ContentPane (または同様のもの) を取得する可能性はありますか?

thx、アンドレ

4

1 に答える 1

0

echoPointNG で解決策を見つけました:

public static ContainerEx createCenteredPane( int width, int height ) {
    ContainerEx cp = new ContainerEx();
    cp.setPosition( Positionable.ABSOLUTE );
    cp.setOutsets( new Insets( width / 2 * -1, height / 2 * -1, 0, 0 ) );
    cp.setWidth( new Extent( width ) );
    cp.setHeight( new Extent( height ) );
    cp.setLeft( new Extent( 50, Extent.PERCENT ) );
    cp.setTop( new Extent( 50, Extent.PERCENT ) );
    return cp;
}
于 2010-03-19T08:30:55.650 に答える