ImagePaint.java Source code

Java tutorial

Introduction

Here is the source code for ImagePaint.java

Source

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;

public class ImagePaint {

    public static void main(String[] args) {
        Display display = new Display();

        Image image = new Image(display, 20, 20);
        Color black = display.getSystemColor(SWT.COLOR_BLACK);
        GC gc = new GC(image);
        gc.setForeground(black);
        gc.drawString("Test", 2, 2);

        gc.dispose();
        display.dispose();
    }
}