私は独自のウィジェット (extending Canvas
) を実装しました。これは、すべて黒であるという明確な特徴があります。
キャンバスをShell
WindowBuilder のデザイン モードに追加すると、通常のキャンバスのように見えますが、実行モードではすべて問題なく表示されます。
不足しているものはありますか、それとも WindowBuilder の固有の制限ですか?
念のため、私が使用しているコードは次のとおりです。
public class MyCanvas extends Canvas {
public MyCanvas(Composite parent, int style) {
super(parent, style);
setBackground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
addPaintListener(new PaintListenerEx());
}
private class PaintListenerEx implements PaintListener {
@Override
public void paintControl(PaintEvent e) {
e.gc.fillRectangle(MyCanvas.this.getBounds());
e.gc.dispose();
}
}
}