Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextFigure.java')
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextFigure.java57
1 files changed, 0 insertions, 57 deletions
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextFigure.java
deleted file mode 100755
index 260f3a04f8..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextFigure.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Rectangle object
- */
-public class TextFigure extends Figure {
- private Color color;
- private Font font;
- private String text;
- private int x, y;
- /**
- * Constructs a TextFigure
- *
- * @param color the color for this object
- * @param font the font for this object
- * @param text the text to draw, tab and new-line expansion is performed
- * @param x the virtual X coordinate of the top-left corner of the text bounding box
- * @param y the virtual Y coordinate of the top-left corner of the text bounding box
- */
- public TextFigure(Color color, Font font, String text, int x, int y) {
- this.color = color; this.font = font; this.text = text; this.x = x; this.y = y;
- }
- public void draw(GC gc, Point offset) {
- gc.setFont(font);
- gc.setForeground(color);
- gc.drawText(text, x + offset.x, y + offset.y, true);
- }
- public Object drawPreview(GC gc, Point offset) {
- Color oldColor = gc.getForeground();
- gc.setFont(font);
- gc.setForeground(color);
- gc.setXORMode(false);
-
- Point textExtent = gc.textExtent(text);
- Image backingStore = new Image(null, textExtent.x, textExtent.y);
- gc.copyArea(backingStore, x + offset.x, y + offset.y);
-
- gc.drawText(text, x + offset.x, y + offset.y, true);
- gc.setForeground(oldColor);
- gc.setXORMode(true);
- return backingStore;
- }
- public void erasePreview(GC gc, Point offset, Object rememberedData) {
- Image backingStore = (Image) rememberedData;
- gc.setXORMode(false);
- gc.drawImage(backingStore, x + offset.x, y + offset.y);
- gc.setXORMode(true);
- backingStore.dispose();
- }
-}

Back to the top