These two lines can be placed on the 'execute' method of an Action, or the 'widgedSelected' method of a SelectionListener. new Thread( new MyRunnable( "RUN_A", true ), "A" ).start(); //$NON-NLS-1$ //$NON-NLS-2$ new Thread( new MyRunnable( "RUN_B", false ), "B" ).start(); //$NON-NLS-1$ //$NON-NLS-2$ This class can be used as an inner class within the same file where the two lines above where used. private static class MyRunnable implements Runnable { private String name; private boolean singleColor; public MyRunnable( String name, boolean singleColor ) { this.name = name; this.singleColor = singleColor; } @Override public void run() { Color colorA = null; Color colorB = null; if ( singleColor ) { colorA = new Color( Display.findDisplay( Thread.currentThread() ), 255, 0, 128 ); } else { colorA = new Color( Display.findDisplay( Thread.currentThread() ), 193, 98, 107 ); colorB = new Color( Display.findDisplay( Thread.currentThread() ), 146, 190, 137 ); } Display display = new Display(); Image image = new Image( display, 1000, 1000 ); GC gc = new GC( image ); int items = 20; for ( int i = 0; i < items; i++ ) { for ( int j = 0; j < items; j++ ) { int x = i * ( 1000 / items ) + ( 1000 / items / 4 ); int y = j * ( 1000 / items ) + ( 1000 / items / 4 ); gc.setAntialias( (int) ( Math.random() * 2 ) ); Color bg; if ( singleColor ) { bg = colorA; } else { if ( ( i + j ) % 2 == 1 ) { bg = colorA; } else { bg = colorB; } } gc.setBackground( bg ); gc.fillRectangle( x, y, 1000 / items / 2, 1000 / items / 2 ); } } ImageLoader imageLoader = new ImageLoader(); imageLoader.data = new ImageData[] { image.getImageData() }; imageLoader.save( "C:\\img\\" + name + ".png", SWT.IMAGE_PNG ); //$NON-NLS-1$ //$NON-NLS-2$ gc.dispose(); image.dispose(); display.dispose(); colorA.dispose(); if ( colorB != null ) { colorB.dispose(); } } }