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

The following examples show how to use org.eclipse.swt.graphics.GC#setForeground() . 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: DefaultDropPointRenderer.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/** 
 * {@inheritDoc}
 */
public void paint(GC gc, Object value)
{
    gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));

    gc.fillPolygon(new int[] {getBounds().x + 0, getBounds().y + 4, getBounds().x + 4,
                              getBounds().y + 0, getBounds().x + 8, getBounds().y + 4,
                              getBounds().x + 7, getBounds().y + 5, getBounds().x + 6,
                              getBounds().y + 5, getBounds().x + 4, getBounds().y + 3,
                              getBounds().x + 2, getBounds().y + 5, getBounds().x + 1,
                              getBounds().y + 5 });

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

    gc.drawPolyline(new int[] {getBounds().x + 0, getBounds().y + 4, getBounds().x + 4,
                               getBounds().y + 0, getBounds().x + 8, getBounds().y + 4,
                               getBounds().x + 7, getBounds().y + 5, getBounds().x + 6,
                               getBounds().y + 5, getBounds().x + 4, getBounds().y + 3,
                               getBounds().x + 2, getBounds().y + 5, getBounds().x + 1,
                               getBounds().y + 5 });

}
 
Example 2
Source File: TextColorDrawingStrategy.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
@Override
public void draw(Annotation annotation, GC gc, StyledText textWidget, int start, int length, Color color) {
  if (length > 0) {
    if (annotation instanceof EclipseAnnotationPeer) {
      if (gc != null) {

        int end = start + length - 1;

        Rectangle bounds = textWidget.getTextBounds(start, end);

        gc.setForeground(color);

        gc.drawText(textWidget.getText(start, end), bounds.x, bounds.y, true);

      } else {
        textWidget.redrawRange(start, length, true);
      }
    }
  }
}
 
Example 3
Source File: DefaultTopLeftRenderer.java    From nebula with Eclipse Public License 2.0 6 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.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);

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

}
 
Example 4
Source File: RangeSlider.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Draw the background
 *
 * @param gc graphic context
 */
private void drawBackgroundHorizontal(final GC gc) {
	final Rectangle clientArea = getClientArea();

	gc.setBackground(getBackground());
	gc.fillRectangle(clientArea);

	if (isEnabled()) {
		gc.setForeground(getForeground());
	} else {
		gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_GRAY));
	}
	gc.drawRoundRectangle(9, 9, clientArea.width - 20, clientArea.height - 20, 3, 3);

	final float pixelSize = computePixelSizeForHorizontalSlider();
	final int startX = (int) (pixelSize * lowerValue);
	final int endX = (int) (pixelSize * upperValue);
	if (isEnabled()) {
		gc.setBackground(getForeground());
	} else {
		gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_GRAY));
	}
	gc.fillRectangle(12 + startX, 9, endX - startX - 6, clientArea.height - 20);

}
 
Example 5
Source File: RendererBase.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Helper method to restore attribute values saved with <code>saveGCAttributes</code>.
 * 
 * @param gc GC to restore attributes for
 */
protected void restoreGCAttributes(GC gc) {
    if (_bgColor == null) {
        throw new RuntimeException("no attributes saved");
    }
    gc.setBackground(_bgColor);
    gc.setForeground(_fgColor);
    gc.setFont(_font);
    gc.setLineWidth(_lineWidth);
}
 
Example 6
Source File: MessageComposite.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void paintControl( PaintEvent pev )
{
	Rectangle rCA = getClientArea( );
	rCA.width--;
	rCA.height--;
	GC gc = pev.gc;
	gc.setForeground( Display.getCurrent( ).getSystemColor( SWT.COLOR_GRAY ) );
	gc.drawRectangle( rCA );
}
 
Example 7
Source File: TagCloud.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
private ImageData createImageData(final Word word, Font font, Point stringExtent, final double sin,
		final double cos, int x, int y, Color color) {
	Image img = new Image(null, x, y);
	word.width = x;
	word.height = y;
	word.stringExtent = stringExtent;
	GC g = new GC(img);
	g.setAntialias(antialias);
	g.setForeground(color);
	Transform t = new Transform(img.getDevice());
	if (word.angle < 0) {
		t.translate(0, img.getBounds().height - (int) (cos * stringExtent.y));
	} else {
		t.translate((int) (sin * stringExtent.y), 0);
	}
	t.rotate(word.angle);
	g.setTransform(t);
	g.setFont(font);
	// Why is drawString so slow? between 30 and 90 percent of the whole
	// draw time...
	g.drawString(word.string, 0, 0, false);
	int max = Math.max(x, y);
	int tmp = maxSize;
	while (max < tmp) {
		tmp = tmp / 2;
	}
	tmp = tmp * 2;
	SmallRect root = new SmallRect(0, 0, tmp, tmp);
	word.tree = new RectTree(root, accuracy);
	final ImageData id = img.getImageData();
	g.dispose();
	img.dispose();
	return id;
}
 
Example 8
Source File: HistogramView.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private void updateLegendArea() {
    for (Control c: fLegendArea.getChildren()) {
        c.dispose();
    }
    disposeLegendImages();
    if (fFullTraceHistogram.showTraces()) {
        Collection<ITmfTrace> traces = TmfTraceManager.getTraceSet(fTrace);
        fLegendImages = new Image[traces.size()];
        int traceIndex = 0;
        for (ITmfTrace trace : traces) {
            fLegendImages[traceIndex] = new Image(fLegendArea.getDisplay(), 16, 16);
            GC gc = new GC(fLegendImages[traceIndex]);
            gc.setBackground(fFullTraceHistogram.getTraceColor(traceIndex));
            gc.fillRectangle(0, 0, 15, 15);
            gc.setForeground(fLegendArea.getDisplay().getSystemColor(SWT.COLOR_BLACK));
            gc.drawRectangle(0, 0, 15, 15);
            gc.dispose();

            CLabel label = new CLabel(fLegendArea, SWT.NONE);
            label.setText(trace.getName());
            label.setImage(fLegendImages[traceIndex]);
            traceIndex++;
        }
    }
    fLegendArea.layout();
    fLegendArea.getParent().layout();
}
 
Example 9
Source File: VButtonPainter.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @param gc
 * @param bounds
 * @param state
 */
private void doPaintBackground(GC gc, Rectangle bounds, int state) {
	Color outline = null, bkBlue = null;

	if ((state & VControl.STATE_SELECTED) == VControl.STATE_SELECTED) {
		outline = button.selectedBorderColor == null
				? button.defaultSelectedBorderColor
				: button.selectedBorderColor;
		bkBlue = button.selectedBackgroundColor == null
				? button.defaultSelectedBackgroundColor
				: button.selectedBackgroundColor;
	} else if ((state & VControl.STATE_ACTIVE) == VControl.STATE_ACTIVE) {
		outline = button.hoverBorderColor == null
				? button.defaultHoverBorderColor
				: button.hoverBorderColor;
		bkBlue = button.hoverBackgroundColor == null
				? button.defaultHoverBackgroundColor
				: button.hoverBackgroundColor;
	}

	if (outline != null && bkBlue != null) {
		gc.setBackground(bkBlue);
		gc.setForeground(outline);

		gc.fillRectangle(0, 0, bounds.width - 1, bounds.height - 1);
		gc.drawRectangle(0, 0, bounds.width - 1, bounds.height - 1);

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

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

    gc.drawLine(x+3, y+4, x+5, y+4);
    gc.drawLine(x+1, y+3, x+6, y+3);
    gc.drawLine(x+1, y+2, x+7, y+2);
}
 
Example 11
Source File: MinMaxToggleRenderer.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public void paint(GC gc, Object value)
{

    Transform transform = new Transform(gc.getDevice());
    transform.translate(getBounds().x, getBounds().y);
    gc.setTransform(transform);

    gc.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));

    if (isHover())
    {
        gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
        gc.drawRoundRectangle(0, 0, 17, 17, 5, 5);
    }

    gc.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));

    if (isExpanded())
    {
        gc.fillRectangle(4, 3, 9, 3);
        gc.drawRectangle(4, 3, 9, 3);
    }
    else
    {
        gc.fillRectangle(4, 3, 9, 9);
        gc.drawRectangle(4, 3, 9, 9);
        gc.drawLine(4, 5, 13, 5);
    }

    gc.setTransform(null);
    transform.dispose();

}
 
Example 12
Source File: DefaultInsertMarkRenderer.java    From translationstudio8 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 13
Source File: CTreeCell.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
void paintCell(GC gc, Point offset) {
	if(activeBackground != null) gc.setBackground(activeBackground);
	if(activeForeground != null) gc.setForeground(activeForeground);

	// background
	gc.fillRectangle(
			bounds.x+offset.x,
			bounds.y+offset.y,
			bounds.width,
			bounds.height
	);

	// images
	for(int i = 0; i < iBounds.length; i++) {
		if(!images[i].isDisposed()) {
			gc.drawImage(images[i], offset.x+iBounds[i].x, offset.y+iBounds[i].y);
		}
	}

	// text
	if(getText().length() > 0) {
		Font bf = gc.getFont();
		if(getFont() != null) gc.setFont(getFont());
		gc.drawText(getText(), offset.x+tBounds.x, offset.y+tBounds.y);
		if(getFont() != null) gc.setFont(bf);
	}
	
	if(((CTreeItem) item).getTreeCell() == this) {
		paintChildLines(gc, offset);
	}
	
	// toggle (it changes the colors again so paint it last...)
	if(toggleVisible) {
		paintToggle(gc, offset);
	}
}
 
Example 14
Source File: TimeGraphControl.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Draw the grid lines
 *
 * @param bounds
 *            The bounds of the control
 * @param gc
 *            Graphics context
 * @since 2.0
 */
public void drawGridLines(Rectangle bounds, GC gc) {
    if (!fGridLinesVisible) {
        return;
    }
    gc.setForeground(fGridLineColor);
    gc.setAlpha(fGridLineColor.getAlpha());
    for (int x : fTimeGraphScale.getTickList()) {
        gc.drawLine(x, bounds.y, x, bounds.y + bounds.height);
    }
    gc.setAlpha(OPAQUE);
}
 
Example 15
Source File: DefaultInsertMarkRenderer.java    From nebula with Eclipse Public License 2.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 16
Source File: GanttControlParent.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public void paintControl(PaintEvent e) {
    GC gc = e.gc;

    Rectangle bounds = getBounds();
    if (__ganttChart != null) {
        IColorManager colorManager = __ganttChart.getColorManager();
        gc.setForeground(colorManager.getWeekdayBackgroundColorTop());
        gc.setBackground(colorManager.getWeekdayBackgroundColorBottom());
        gc.fillGradientRectangle(0, 0, bounds.width, bounds.height, true);
    } else {
        gc.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
        gc.fillRectangle(bounds);
    }
}
 
Example 17
Source File: LoginDialog.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Create a default image. It is a port of the image used by the Login Box
 * in the project SwingX
 *
 * @param w width
 * @param h height
 * @return a default image (blue wave)
 */
private Image createDefaultImage(final int w, final int h) {
	final Display display = Display.getCurrent();
	final Color backgroundColor = new Color(display, 49, 121, 242);
	final Color gradientColor1 = new Color(display, 155, 185, 245);
	final Color gradientColor2 = new Color(display, 53, 123, 242);

	final Image img = new Image(display, w, h);
	final GC gc = new GC(img);
	gc.setAdvanced(true);
	gc.setAntialias(SWT.ON);
	gc.setBackground(backgroundColor);
	gc.fillRectangle(0, 0, w, h);

	final Path curveShape = new Path(display);
	curveShape.moveTo(0, h * .6f);
	curveShape.cubicTo(w * .167f, h * 1.2f, w * .667f, h * -.5f, w, h * .75f);
	curveShape.lineTo(w, h);
	curveShape.lineTo(0, h);
	curveShape.lineTo(0, h * .8f);
	curveShape.close();

	final Pattern pattern = new Pattern(display, 0, 0, 1, h * 1.2f, gradientColor1, gradientColor2);
	gc.setBackgroundPattern(pattern);
	gc.fillPath(curveShape);

	final Font font = new Font(display, "Arial Bold", 30, SWT.NONE);
	gc.setFont(font);
	gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
	final Point textSize = gc.stringExtent(ResourceManager.getLabel(ResourceManager.LOGIN));
	gc.drawString(ResourceManager.getLabel(ResourceManager.LOGIN), (int) (w * .05f), (h - textSize.y) / 2, true);

	font.dispose();
	curveShape.dispose();
	pattern.dispose();
	backgroundColor.dispose();
	gradientColor1.dispose();
	gradientColor2.dispose();
	gc.dispose();
	return img;
}
 
Example 18
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();
}
 
Example 19
Source File: AbstractPaintManager.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
private void drawCheckpointMarker(final GC gc, final ISettings settings, final IColorManager colorManager, final GanttEvent event, final boolean threeDee, final int x, final int y, final int width, final int height, final Rectangle bounds) {
    final float fHoriSpacer = width * 0.17f;
    final int hSpacer = (int) fHoriSpacer;

    final float fVertiSpacer = height * 0.23f;
    final int vSpacer = (int) fVertiSpacer;

    final Rectangle topToBottom = new Rectangle(x + hSpacer, y, width - (hSpacer * 2), height + vSpacer);
    final Rectangle leftToRight = new Rectangle(x, y + vSpacer, width, height - vSpacer);
    final Rectangle inner = new Rectangle(x + hSpacer, y + vSpacer, width - (hSpacer * 2), height - (vSpacer * 2));

    Color cEvent = event.getStatusColor();
    Color gradient = event.getGradientStatusColor();

    if (cEvent == null) {
        cEvent = settings.getDefaultEventColor();
    }
    if (gradient == null) {
        gradient = settings.getDefaultGradientEventColor();
    }

    gc.setForeground(gradient);
    gc.setBackground(cEvent);
    gc.fillRectangle(topToBottom);
    gc.fillRectangle(leftToRight);
    gc.fillGradientRectangle(inner.x, inner.y, inner.width, inner.height, true);

    gc.setForeground(colorManager.getBlack());

    gc.drawRectangle(topToBottom);
    gc.drawRectangle(leftToRight);

    if (threeDee) {
        final boolean alpha = (colorManager.useAlphaDrawing() || colorManager.useAlphaDrawingOn3DEventDropShadows());
        if (alpha) {
            gc.setAlpha(200);
        }

        gc.setForeground(colorManager.getFadeOffColor1());
        // horizontal line.. ends a few pixles right of bottom right corner
        gc.drawLine(leftToRight.x, leftToRight.y + leftToRight.height + 1, leftToRight.x + hSpacer - 1, leftToRight.y + leftToRight.height + 1);
        gc.drawLine(leftToRight.x + hSpacer, leftToRight.y + leftToRight.height + vSpacer + 1, leftToRight.x - hSpacer + leftToRight.width, leftToRight.y + leftToRight.height + vSpacer + 1);
        gc.drawLine(leftToRight.x + leftToRight.width - hSpacer + 1, leftToRight.y + leftToRight.height + 1, leftToRight.x + leftToRight.width + 1, leftToRight.y + leftToRight.height + 1);

        // vertical line at end, starts slightly below top right corner
        gc.drawLine(leftToRight.x + leftToRight.width + 1, leftToRight.y + 2, leftToRight.x + leftToRight.width + 1, leftToRight.y + leftToRight.height + 1);

        if (alpha) {
            gc.setAlpha(100);
        }

        gc.setForeground(colorManager.getFadeOffColor2());
        gc.drawLine(leftToRight.x, leftToRight.y + leftToRight.height + 2, leftToRight.x + hSpacer - 1, leftToRight.y + leftToRight.height + 2);
        gc.drawLine(leftToRight.x + hSpacer, leftToRight.y + leftToRight.height + vSpacer + 2, leftToRight.x - hSpacer + leftToRight.width, leftToRight.y + leftToRight.height + vSpacer + 2);
        gc.drawLine(leftToRight.x + leftToRight.width - hSpacer + 1, leftToRight.y + leftToRight.height + 2, leftToRight.x + leftToRight.width + 1, leftToRight.y + leftToRight.height + 2);

        gc.drawLine(leftToRight.x + leftToRight.width + 2, leftToRight.y + 3, leftToRight.x + leftToRight.width + 2, leftToRight.y + leftToRight.height + 1);

        if (alpha) {
            gc.setAlpha(50);
        }

        gc.setForeground(colorManager.getFadeOffColor3());
        gc.drawLine(leftToRight.x, leftToRight.y + leftToRight.height + 3, leftToRight.x + hSpacer - 1, leftToRight.y + leftToRight.height + 3);
        gc.drawLine(leftToRight.x + hSpacer, leftToRight.y + leftToRight.height + vSpacer + 3, leftToRight.x - hSpacer + leftToRight.width, leftToRight.y + leftToRight.height + vSpacer + 3);
        gc.drawLine(leftToRight.x + leftToRight.width - hSpacer + 1, leftToRight.y + leftToRight.height + 3, leftToRight.x + leftToRight.width + 1, leftToRight.y + leftToRight.height + 3);

        gc.drawLine(leftToRight.x + leftToRight.width + 3, leftToRight.y + 4, leftToRight.x + leftToRight.width + 3, leftToRight.y + leftToRight.height + 1);

        if (alpha) {
            gc.setAlpha(255);
            gc.setAdvanced(false);
        }

    }
}
 
Example 20
Source File: MarkerEditorComposite.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void paintControl( PaintEvent e )
{
	GC gc = e.gc;
	int markerIndex = ( (Integer) e.widget.getData( ) ).intValue( );
	int markerLength = typeNameSet.length;
	String typeName = null;
	if ( markerIndex < markerLength )
	{
		typeName = typeNameSet[markerIndex];
		gc.setBackground( Display.getDefault( )
				.getSystemColor( SWT.COLOR_INFO_BACKGROUND ) );
		gc.fillRectangle( 0, 0, MARKER_BLOCK_WIDTH, MARKER_BLOCK_HEIGHT );
	}

	int lineWidth = 1;
	if ( isMarkerTypeEnabled( ) )
	{
		gc.setForeground( Display.getDefault( )
				.getSystemColor( SWT.COLOR_BLACK ) );
	}
	else
	{
		gc.setForeground( Display.getDefault( )
				.getSystemColor( SWT.COLOR_GRAY ) );
	}
	gc.setLineWidth( lineWidth );

	int x = lineWidth - 1;
	int y = lineWidth - 1;
	int width = MARKER_BLOCK_WIDTH + 1 - 2 * lineWidth;
	int height = MARKER_BLOCK_HEIGHT + 1 - 2 * lineWidth;

	if ( markerIndex / MARKER_ROW_MAX_NUMBER < markerLength
			/ MARKER_ROW_MAX_NUMBER )
	{
		// Remove the bottom border if not in the last row
		height++;
	}
	if ( ( markerIndex + 1 ) % MARKER_ROW_MAX_NUMBER != 0 )
	{
		// Remove the right border if not in the rightmost column
		width++;
	}
	if ( typeName == null )
	{
		if ( markerIndex > markerLength )
		{
			// Remove the left and right border of the fake node unless
			// it's next to the last
			x = -1;
			width += 2;
		}
		// Remove the bottom border of the fake node
		height++;
	}
	// Draw the border
	gc.drawRectangle( x, y, width, height );

	// Draw the boarder of current marker
	if ( getMarker( ).getType( ).getName( ).equals( typeName ) )
	{
		markerTypeIndex = markerIndex;
		gc.setForeground( Display.getDefault( )
				.getSystemColor( SWT.COLOR_RED ) );
		gc.drawRectangle( 1,
				1,
				MARKER_BLOCK_WIDTH - 2,
				MARKER_BLOCK_HEIGHT - 2 );
	}

	// Draw the marker
	if ( typeName != null )
	{
		paintMarker( gc,
				MarkerImpl.create( MarkerType.getByName( typeName ), 4 ),
				LocationImpl.create( MARKER_BLOCK_WIDTH / 2,
						MARKER_BLOCK_HEIGHT / 2 ) );
	}
}