我是Echo 2框架的新手。我认为它应该很简单,但我发现没有办法将生成的内容水平和垂直居中。有没有可能得到一个具有固定宽度和高度的居中ContentPane (或类似的东西)?
thx,André
发布于 2010-03-19 16:30:56
使用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;
}https://stackoverflow.com/questions/153396
复制相似问题