MyComposite
サイズの変更をアニメーション化したいクラスがあります。
そのために、ループでサイズを変更しています。
各ループ処理の後、 を呼び出しますlayout()
。
残念ながら、コンポジットは反復ごとに再描画されませんが、コンポジットの最終サイズに直接ジャンプします。
サイズが変更されるたびにウィジェットを強制的に再描画するにはどうすればよいですか?
MyComposite とアニメーション:
//start
new Animation().start(myComposite);
...
public MyComposite(Composite parent, int style, int bgcolor) {
super(parent, style);
this.setBackground(getDisplay().getSystemColor(bgcolor));
}
@Override
public Point computeSize(int wHint, int hHint, boolean changed) {
return super.computeSize(width, height, changed);
}
class Animation{
public void start(MyComposite composite){
for(int i=0; i<1000; i++){
composite.width++;
composite.getParent().layout(true, true);
}
}
}
マイコンポジット: