draw2d



子供の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してやる必要がある

最終更新:2011年01月13日 11:34
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。