「draw2d」の編集履歴(バックアップ)一覧はこちら
「draw2d」(2011/01/13 (木) 11:34:30) の最新版変更点
追加された行は緑色になります。
削除された行は赤色になります。
----
子供のIFigureの位置によって勝手に大きさが変わるIFigure
org.eclipse.draw2d.FreeformLayer
余白を調整する場合は FreeformLayer に Border をセットして Border の Insets を用いると楽。
MarginBorder border = new MarginBorder(200,200,200,200);
contentPane.setBorder(border);
----
影のついたFigureの例
Figure shadow = new Figure() {
@Override
protected void paintFigure(Graphics graphics) {
//自身を描画するときは透明にする
graphics.pushState();
graphics.setAlpha(100);
if (isOpaque()) {
Rectangle bounds = getBounds().getCopy();
bounds.shrink(3, 3);
bounds.translate(3, 3);
graphics.fillRectangle(bounds);
}
if (getBorder() instanceof AbstractBackground){
((AbstractBackground) getBorder()).paintBackground(this,graphics, NO_INSETS);
}
graphics.popState();
}
};
----
//その他描画方法
//FigureUtilities.makeGhostShape(shadow);
// Color col = FigureUtilities.lighter(FigureUtilities.lighter(ColorConstants.lightGray));
----
----
子供のIFigureの位置によって勝手に大きさが変わるIFigure
org.eclipse.draw2d.FreeformLayer
余白を調整する場合は FreeformLayer に Border をセットして Border の Insets を用いると楽。
MarginBorder border = new MarginBorder(200,200,200,200);
contentPane.setBorder(border);
----
影のついたFigureの例
Figure shadow = new Figure() {
@Override
protected void paintFigure(Graphics graphics) {
//自身を描画するときは透明にする
graphics.pushState();
graphics.setAlpha(100);
if (isOpaque()) {
Rectangle bounds = getBounds().getCopy();
bounds.shrink(3, 3);
bounds.translate(3, 3);
graphics.fillRectangle(bounds);
}
if (getBorder() instanceof AbstractBackground){
((AbstractBackground) getBorder()).paintBackground(this,graphics, NO_INSETS);
}
graphics.popState();
}
};
----
//その他描画方法
//FigureUtilities.makeGhostShape(shadow);
// Color col = FigureUtilities.lighter(FigureUtilities.lighter(ColorConstants.lightGray));
----
graphics.setLineStyle(SWT.LINE_CUSTOM);
graphics.setLineDash(new int[] { 3, 3 });
をやってから、すぐ
graphics.setLineStyle(SWT.LINE_SOLID);
をやってもWindowでは有効にならない(MacではOK)
graphics.popState();
graphics.pushState();
か
graphics.restoreState();
を間に入れる
----
チルトホイールマウスの横スクロールに対応するイベントタイプ
SWT.MouseHorizontalWheel
標準のLightweightSystemでは未対応(Helios)なので、自前でaddしてやる必要がある
----