Java Code Examples for org.eclipse.swt.graphics.GC#drawLine()

The following examples show how to use org.eclipse.swt.graphics.GC#drawLine() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Chips.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
private int drawCheck(final GC gc, final int x) {
	Color foreground = null;
	if (cursorInside) {
		foreground = hoverForeground;
	} else if (isPush && selection) {
		foreground = pushedStateForeground;
	}
	foreground = foreground == null ? getForeground() : foreground;
	gc.setForeground(foreground);
	gc.setLineWidth(2);

	final Rectangle rect = getClientArea();

	final int centerX = x + 4 + CLOSE_CIRCLE_RAY;
	final int centerY = (rect.height - 2 * CLOSE_CIRCLE_RAY) / 2 + CLOSE_CIRCLE_RAY;
	gc.drawLine(x + 6, centerY, x + 9, centerY + 4);
	gc.drawLine(x + 9, centerY + 4, centerX + 4, centerY - 3);
	return x + 16;
}
 
Example 2
Source File: SwtScatterChart.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private void drawHoveringCross(GC gc) {
    if (fHoveredPoint == null) {
        return;
    }

    gc.setLineWidth(1);
    gc.setLineStyle(SWT.LINE_SOLID);
    gc.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
    gc.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));

    /* Vertical line */
    gc.drawLine(fHoveringPoint.x, 0, fHoveringPoint.x, getChart().getPlotArea().getSize().y);

    /* Horizontal line */
    gc.drawLine(0, fHoveringPoint.y, getChart().getPlotArea().getSize().x, fHoveringPoint.y);
}
 
Example 3
Source File: TimeGraphRender.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected void innerDraw(GC gc) {
    Rectangle drawRect = getBounds();
    if (drawRect.width >= 2) {
        gc.fillRectangle(drawRect);
        if (drawRect.width > 2) {
            // Draw the top and bottom borders
            RGBAColor foregroundRGB = BLACK;
            gc.setAlpha(foregroundRGB.getAlpha());
            gc.setForeground(getColor(foregroundRGB.toInt()));
            gc.drawLine(drawRect.x, drawRect.y, drawRect.x + drawRect.width - 1, drawRect.y);
            gc.drawLine(drawRect.x, drawRect.y + drawRect.height - 1, drawRect.x + drawRect.width - 1, drawRect.y + drawRect.height - 1);
        }
    } else {
        gc.setForeground(gc.getBackground());
        gc.drawLine(drawRect.x, drawRect.y, drawRect.x, drawRect.y + drawRect.height - 1);
    }

}
 
Example 4
Source File: DefaultEmptyColumnFooterRenderer.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/** 
 * {@inheritDoc}
 */
public void paint(GC gc, Object value)
{
    gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));

    gc.fillRectangle(getBounds().x, getBounds().y, getBounds().width + 1,
                     getBounds().height + 1);
    gc.drawLine(getBounds().x, getBounds().y, getBounds().x
            + getBounds().width, getBounds().y);
}
 
Example 5
Source File: ImageLabel.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Draw a rectangle in the given colors.
 */
private void drawBevelRect( GC gc, int x, int y, int w, int h,
		Color topleft, Color bottomright )
{
	gc.setForeground( bottomright );
	gc.drawLine( x + w, y, x + w, y + h );
	gc.drawLine( x, y + h, x + w, y + h );

	gc.setForeground( topleft );
	gc.drawLine( x, y, x + w - 1, y );
	gc.drawLine( x, y, x, y + h - 1 );
}
 
Example 6
Source File: Win7ColumnHeaderUtil.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Draw an additional shadow for the selected column state
 *
 * @param graphics
 * @param bounds
 * @param palette
 */
protected static void drawColumnSelectedTopShadow(GC graphics, Rectangle bounds, Palette palette) {
	int x = bounds.x;
	int y = bounds.y;

	graphics.setForeground(palette.getColors()[0]);
	graphics.drawLine(x + 1, y, x + bounds.width - 2, y);
	graphics.setForeground(palette.getColors()[1]);
	graphics.drawLine(x + 1, y + 1, x + bounds.width - 2, y + 1);
}
 
Example 7
Source File: DefaultInsertMarkRenderer.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Renders the insertion mark.  The bounds of the renderer
 * need not be set.
 * 
 * @param gc
 * @param value  must be a {@link Rectangle} with height == 0.
 */
public void paint(GC gc, Object value)
{
	Rectangle r = (Rectangle)value;

	gc.setLineStyle(SWT.LINE_SOLID);
	gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION));

	gc.drawLine(r.x, r.y-1, r.x+r.width, r.y-1);
	gc.drawLine(r.x, r.y  , r.x+r.width, r.y  );
	gc.drawLine(r.x, r.y+1, r.x+r.width, r.y+1);

	gc.drawLine(r.x-1,  r.y-2,  r.x-1,   r.y+2);
	gc.drawLine(r.x-2,  r.y-3,  r.x-2,   r.y+3);
}
 
Example 8
Source File: BaseSwtParameter.java    From BiglyBT with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handleEvent(Event event) {
	if (parent == null || control.isDisposed()) {
		return;
	}

	Rectangle boundsInParent = control.getBounds();
	if (boundsInParent.width == 0 || boundsInParent.height == 0) {
		return;
	}
	Rectangle bounds = control.getBounds();
	GC gc = event.gc;
	Display display = event.display;
	if (gc == null || display == null) {
		return;
	}

	int x = boundsInParent.x - width + 18;
	int x2 = x + width - 22;
	int y = boundsInParent.y;
	int y2 = boundsInParent.y + (bounds.height / 2);
	gc.setLineStyle(SWT.LINE_DASH);
	gc.setLineDash(new int[] {
		3,
		2
	});
	gc.setForeground(display.getSystemColor(parent.isEnabled()
			? SWT.COLOR_WIDGET_FOREGROUND : SWT.COLOR_WIDGET_LIGHT_SHADOW));
	gc.drawLine(x, y, x, y2);
	gc.drawLine(x, y2, x2, y2);

	x++;
	y++;
	y2++;
	x2++;
	gc.setForeground(display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
	gc.drawLine(x, y, x, y2);
	gc.drawLine(x, y2, x2, y2);

}
 
Example 9
Source File: MonthCalendarableItemControl.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Draw a rectangle in the given colors.
 */
private void drawBevelRect(GC gc, int x, int y, int w, int h, Color topleft, Color bottomright) {
	gc.setForeground(bottomright);
	gc.drawLine(x+w, y,   x+w, y+h);
	gc.drawLine(x,   y+h, x+w, y+h);
	
	gc.setForeground(topleft);
	gc.drawLine(x, y, x+w-1, y);
	gc.drawLine(x, y, x,     y+h-1);
}
 
Example 10
Source File: BorderPainter.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
public void paintControl(PaintEvent e) {
  Composite composite = (Composite) e.widget;
  Rectangle bounds = composite.getBounds();
  GC gc = e.gc;
  gc.setLineStyle(SWT.LINE_DOT);
  gc.drawLine(bounds.x, bounds.y, bounds.x + bounds.width, bounds.y);
}
 
Example 11
Source File: RoundedComposite.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
/** Updates the rounded rectangle background. */
private void paint(final PaintEvent e) {

  final Color backgroundToUse = getBackground();
  final Color borderToUser =
      border != null ? border : getDisplay().getSystemColor(SWT.COLOR_BLACK);

  final Rectangle bounds = getBounds();
  final Rectangle clientArea = getClientArea();

  final GC gc = e.gc;

  gc.setBackground(parent.getBackground());
  gc.fillRectangle(new Rectangle(e.x, e.y, e.width, e.height));

  PaintUtils.drawRoundedRectangle(gc, clientArea, backgroundToUse);

  if ((style & SWT.BORDER) != 0) PaintUtils.drawRoundedBorder(gc, clientArea, borderToUser);

  /*
   * If the control shall be displayed as a separator, we draw a
   * horizontal line
   */

  // FIXME why is this using constants of another util class ?
  if ((style & SWT.SEPARATOR) != 0) {
    final int top = (bounds.height - PaintUtils.LINE_WEIGHT) / 2;

    gc.setLineWidth(PaintUtils.LINE_WEIGHT);
    gc.setForeground(backgroundToUse);
    gc.drawLine(PaintUtils.ARC / 2, top, bounds.width - PaintUtils.ARC / 2, top);
  }
}
 
Example 12
Source File: DefaultGalleryGroupRenderer.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Draw the toggle button.
 * 
 * @param gc
 * @param x
 * @param y
 * @param group
 */
protected int drawGroupToggleButton(GC gc, int x, int y,
		GalleryItem group) {
	if (!isAlwaysExpanded()) {
		// Toggle Button

		int xShift = RendererHelper.getShift(titleHeight, 9);
		int yShift = RendererHelper.getShift(titleHeight, 9);

		int toggleX = x + xShift;
		int toggleY = y + yShift;

		gc.setBackground(
				gc.getDevice().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
		gc.fillRectangle(toggleX, toggleY, 8, 8);

		gc.setForeground(
				gc.getDevice().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));
		gc.drawLine(toggleX + 2, toggleY + 4, toggleX + 6, toggleY + 4);
		if (!expanded) {
			gc.drawLine(toggleX + 4, toggleY + 2, toggleX + 4, toggleY + 6);
		}
		gc.setForeground(gc.getDevice()
				.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
		gc.drawRectangle(toggleX, toggleY, 8, 8);

	}

	return titleHeight + minMargin;
}
 
Example 13
Source File: CalendarComposite.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private void drawTitleDays(GC gc) {
	Calendar temp = Calendar.getInstance(mSettings.getLocale());
	// fetch the first day of the week, and draw starting on that day
	int fdow = temp.getFirstDayOfWeek();

	Rectangle bounds = super.getBounds();
	int xStart = mSettings.getDatesLeftMargin() + 5;
	int yStart = bounds.y + mSettings.getHeaderTopMargin() + mSettings.getHeaderHeight() + 1;

	int spacer = 0;
	int letterHeight = 0;

	for (int i = 0; i < 7; i++) {
		Point strWidth = gc.stringExtent(mDayTitles[fdow]);

		int x = xStart + mSettings.getOneDateBoxSize() + spacer - strWidth.x;
		// don't add the string width, as our string width later when
		// drawing days will differ
		mDayXs[i] = xStart + mSettings.getOneDateBoxSize() + spacer;

		gc.drawString(mDayTitles[fdow], x, yStart, true);

		letterHeight = strWidth.y;
		spacer += mSettings.getOneDateBoxSize() + mSettings.getBoxSpacer();

		fdow++;
		if (fdow > 7) {
			fdow = 1;
		}
	}

	int lineStart = yStart + 1 + letterHeight;
	gc.setForeground(mColorManager.getLineColor());
	gc.drawLine(mSettings.getDatesLeftMargin() + 1, lineStart, bounds.width - mSettings.getDatesRightMargin() - 3, lineStart);

	mDatesTopY = lineStart + 3;
}
 
Example 14
Source File: BonitaSashForm.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected void drawLeftRestoreArrow(GC gc, int x, int y) {
    gc.setForeground(arrowColor);

    y+=ARROW_MARGIN;
    gc.drawLine(x+2, y+4, x+5, y+7);
    gc.drawLine(x+2, y+3, x+2, y+3);

    gc.drawLine(x+3, y+2, x+3, y+4);
    gc.drawLine(x+4, y+1, x+4, y+5);
    gc.drawLine(x+5, y,   x+5, y+6);
}
 
Example 15
Source File: SComposite.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private void paintControl(GC gc) {
	if((borderStyle & BORDER) != 0) {
		if(advancedGraphics) {
			gc.setAntialias(SWT.ON);
		}

		gc.setLineWidth(borderWidth);

		Rectangle r = getClientArea();

		if((borderStyle & SQUARE) != 0) {
			if((borderStyle & FLAT) == 0) {
				gc.setForeground(WHITE);
				gc.drawLine(r.x+1,r.y+1, r.x+1,r.y+r.height-3);
				gc.drawLine(r.x+1,r.y+1, r.x+r.width-3,r.y+1);
			}
			gc.setForeground(borderColor);
			gc.drawRectangle(r.x,r.y, r.width-1,r.height-1);
		} else {
			if((borderStyle & FLAT) == 0) {
				gc.setForeground(WHITE);
				gc.drawLine(r.x+1,r.y+1, r.x+1,r.y+r.height-3);
				gc.drawLine(r.x+1,r.y+1, r.x+r.width-3,r.y+1);
			}
			gc.setForeground(borderColor);
			gc.drawRoundRectangle(r.x+(borderWidth/2),r.y+(borderWidth/2), r.width-borderWidth,r.height-borderWidth, borderWidth*5, borderWidth*5);
		}
	}
}
 
Example 16
Source File: DefaultEmptyRowHeaderRenderer.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/** 
 * {@inheritDoc}
 */
public void paint(GC gc, Object value)
{

    gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));

    gc.fillRectangle(getBounds().x, getBounds().y, getBounds().width, getBounds().height + 1);

    gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));

    Grid grid = (Grid) value;
    
    if (!grid.getCellSelectionEnabled())
    {
    
        gc.drawLine(getBounds().x, getBounds().y, getBounds().x + getBounds().width - 1,
                    getBounds().y);
        gc.drawLine(getBounds().x, getBounds().y, getBounds().x, getBounds().y + getBounds().height
                                                                 - 1);

        gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
        gc.drawLine(getBounds().x + 1, getBounds().y + 1,
                    getBounds().x + getBounds().width - 2, getBounds().y + 1);
        gc.drawLine(getBounds().x + 1, getBounds().y + 1, getBounds().x + 1,
                    getBounds().y + getBounds().height - 2);

        gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
        gc.drawLine(getBounds().x + getBounds().width - 1, getBounds().y, getBounds().x
                                                                          + getBounds().width - 1,
                    getBounds().y + getBounds().height - 1);
        gc.drawLine(getBounds().x, getBounds().y + getBounds().height - 1, getBounds().x
                                                                           + getBounds().width - 1,
                    getBounds().y + getBounds().height - 1);

        gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
        gc.drawLine(getBounds().x + getBounds().width - 2, getBounds().y + 1,
                    getBounds().x + getBounds().width - 2, getBounds().y + getBounds().height
                                                           - 2);
        gc.drawLine(getBounds().x + 1, getBounds().y + getBounds().height - 2,
                    getBounds().x + getBounds().width - 2, getBounds().y + getBounds().height
                                                           - 2);
    }
    else
    {
        gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));

        gc.drawLine(getBounds().x + getBounds().width - 1, getBounds().y, getBounds().x
                                                                          + getBounds().width - 1,
                    getBounds().y + getBounds().height - 1);
        gc.drawLine(getBounds().x, getBounds().y + getBounds().height - 1, getBounds().x
                                                                           + getBounds().width - 1,
                    getBounds().y + getBounds().height - 1);
    }

}
 
Example 17
Source File: ToggleRenderer.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/** 
 * {@inheritDoc}
 */
public void paint(GC gc, Object value)
{

    gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));

    gc.fillRectangle(getBounds());

    gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));

    gc.drawRectangle(getBounds().x, getBounds().y, getBounds().width - 1,
                     getBounds().height - 1);

    gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));

    gc.drawLine(getBounds().x + 2, getBounds().y + 4, getBounds().x + 6, getBounds().y + 4);

    if (!isExpanded())
    {
        gc.drawLine(getBounds().x + 4, getBounds().y + 2, getBounds().x + 4, getBounds().y + 6);
    }

}
 
Example 18
Source File: GroupToggleRenderer.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/** 
 * {@inheritDoc}
 */
public void paint(GC gc, Object value)
{

    gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
    gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
    gc.fillArc(getBounds().x, getBounds().y, 8, getBounds().height + -1, 90, 180);
    gc.drawArc(getBounds().x, getBounds().y, 8, getBounds().height + -1, 90, 180);

    gc.fillRectangle(getBounds().x + 4, getBounds().y, getBounds().width - 4,
                     getBounds().height);

    int yMid = ((getBounds().height - 1) / 2);

    if (isHover())
    {
        gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    }
    else
    {
        gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));
    }

    if (isExpanded())
    {
        gc.drawLine(getBounds().x + 5, getBounds().y + yMid, getBounds().x + 8, getBounds().y
                                                                                + yMid - 3);
        gc.drawLine(getBounds().x + 6, getBounds().y + yMid, getBounds().x + 8, getBounds().y
                                                                                + yMid - 2);

        gc.drawLine(getBounds().x + 5, getBounds().y + yMid, getBounds().x + 8, getBounds().y
                                                                                + yMid + 3);
        gc.drawLine(getBounds().x + 6, getBounds().y + yMid, getBounds().x + 8, getBounds().y
                                                                                + yMid + 2);

        gc.drawLine(getBounds().x + 9, getBounds().y + yMid, getBounds().x + 12, getBounds().y
                                                                                 + yMid - 3);
        gc.drawLine(getBounds().x + 10, getBounds().y + yMid, getBounds().x + 12, getBounds().y
                                                                                  + yMid - 2);

        gc.drawLine(getBounds().x + 9, getBounds().y + yMid, getBounds().x + 12, getBounds().y
                                                                                 + yMid + 3);
        gc.drawLine(getBounds().x + 10, getBounds().y + yMid, getBounds().x + 12, getBounds().y
                                                                                  + yMid + 2);
    }
    else
    {
        gc.drawLine(getBounds().x + getBounds().width - 5, getBounds().y + yMid,
                    getBounds().x + getBounds().width - 8, getBounds().y + yMid - 3);
        gc.drawLine(getBounds().x + getBounds().width - 6, getBounds().y + yMid,
                    getBounds().x + getBounds().width - 8, getBounds().y + yMid - 2);

        gc.drawLine(getBounds().x + getBounds().width - 5, getBounds().y + yMid,
                    getBounds().x + getBounds().width - 8, getBounds().y + yMid + 3);
        gc.drawLine(getBounds().x + getBounds().width - 6, getBounds().y + yMid,
                    getBounds().x + getBounds().width - 8, getBounds().y + yMid + 2);

        gc.drawLine(getBounds().x + getBounds().width - 9, getBounds().y + yMid,
                    getBounds().x + getBounds().width - 12, getBounds().y + yMid - 3);
        gc.drawLine(getBounds().x + getBounds().width - 10, getBounds().y + yMid,
                    getBounds().x + getBounds().width - 12, getBounds().y + yMid - 2);

        gc.drawLine(getBounds().x + getBounds().width - 9, getBounds().y + yMid,
                    getBounds().x + getBounds().width - 12, getBounds().y + yMid + 3);
        gc.drawLine(getBounds().x + getBounds().width - 10, getBounds().y + yMid,
                    getBounds().x + getBounds().width - 12, getBounds().y + yMid + 2);
    }

}
 
Example 19
Source File: TokenDrawingStrategy.java    From uima-uimaj with Apache License 2.0 4 votes vote down vote up
@Override
public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length,
        Color color) {
  if (length > 0) {
    if (annotation instanceof EclipseAnnotationPeer) {
      AnnotationFS annotationFS = ((EclipseAnnotationPeer) annotation).getAnnotationFS();
      if (gc != null) {
        Rectangle bounds = textWidget.getTextBounds(offset, offset + length - 1);

        gc.setForeground(color);

        boolean isDrawOpenBracket = annotationFS.getBegin() == offset;
        // and no space before offset
        if (isDrawOpenBracket && offset > 1 && !isWhitespace(annotationFS.getCAS().getDocumentText(), offset - 1)) {
          gc.drawLine(bounds.x, bounds.y + bounds.height - 1, bounds.x + BRACKET_WIDTH, bounds.y
                  + bounds.height - 1);

          gc.drawLine(bounds.x, bounds.y, bounds.x, bounds.y + bounds.height - 1);

          gc.drawLine(bounds.x, bounds.y, bounds.x + BRACKET_WIDTH, bounds.y);
        }

        boolean isDrawCloseBracket = annotationFS.getEnd() == offset + length;
        // and no space after offset
        if (isDrawCloseBracket && offset + length < textWidget.getText().length()
                && !isWhitespace(annotationFS.getCAS().getDocumentText(), offset + length)) {
          gc.drawLine(bounds.x + bounds.width, bounds.y + bounds.height - 1, bounds.x
                  + bounds.width - BRACKET_WIDTH, bounds.y + bounds.height - 1);

          gc.drawLine(bounds.x + bounds.width - 1, bounds.y, bounds.x + bounds.width - 1,
                  bounds.y + bounds.height - 1);

          gc.drawLine(bounds.x + bounds.width, bounds.y, bounds.x + bounds.width - BRACKET_WIDTH,
                  bounds.y);
        }
      } else {
        textWidget.redrawRange(offset, length, true);
      }
    }
  }
}
 
Example 20
Source File: BreadcrumbItemDropDown.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
protected void drawCompositeImage(int width, int height) {
  Display display = fParentComposite.getDisplay();

  Image image = new Image(display, ARROW_SIZE, ARROW_SIZE * 2);

  GC gc = new GC(image);

  Color triangle = createColor(SWT.COLOR_LIST_FOREGROUND,
      SWT.COLOR_LIST_BACKGROUND, 20, display);
  Color aliasing = createColor(SWT.COLOR_LIST_FOREGROUND,
      SWT.COLOR_LIST_BACKGROUND, 30, display);
  gc.setBackground(triangle);

  if (fLTR) {
    gc.fillPolygon(new int[] {
        mirror(0), 0, mirror(ARROW_SIZE), ARROW_SIZE, mirror(0),
        ARROW_SIZE * 2});
  } else {
    gc.fillPolygon(new int[] {
        ARROW_SIZE, 0, 0, ARROW_SIZE, ARROW_SIZE, ARROW_SIZE * 2});
  }

  gc.setForeground(aliasing);
  gc.drawLine(mirror(0), 1, mirror(ARROW_SIZE - 1), ARROW_SIZE);
  gc.drawLine(mirror(ARROW_SIZE - 1), ARROW_SIZE, mirror(0),
      ARROW_SIZE * 2 - 1);

  gc.dispose();
  triangle.dispose();
  aliasing.dispose();

  ImageData imageData = image.getImageData();
  for (int y = 1; y < ARROW_SIZE; y++) {
    for (int x = 0; x < y; x++) {
      imageData.setAlpha(mirror(x), y, 255);
    }
  }
  for (int y = 0; y < ARROW_SIZE; y++) {
    for (int x = 0; x <= y; x++) {
      imageData.setAlpha(mirror(x), ARROW_SIZE * 2 - y - 1, 255);
    }
  }

  int offset = fLTR ? 0 : -1;
  drawImage(imageData, (width / 2) - (ARROW_SIZE / 2) + offset,
      (height / 2) - ARROW_SIZE - 1);

  image.dispose();
}