new interface (for bobbit31)

Posted on 2002-05-24
Medium Priority
Last Modified: 2010-03-31
* Licensed Materials - Property of IBM,
* SWT - The Simple Widget Toolkit,
* (c) Copyright IBM Corp 1998, 1999.

/* Imports */

import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
import java.util.ResourceBundle;

* This example builds on HelloWorld1 and demonstrates how to draw directly
* on an SWT Control.

public class HelloWorld5 implements PaintListener {
private static ResourceBundle resHello = ResourceBundle.getBundle("examples_helloworld");
 static Color red;
 static Shell shell;
public static void main (String [] args)
 HelloWorld5 hw5 = new HelloWorld5();
 Display display = new Display ();
 red = new Color(display, 0xFF, 0, 0);
 shell = new Shell (display);

 shell.addPaintListener (hw5);

 shell.open ();

 while (!shell.isDisposed ())
   if (!display.readAndDispatch ()) display.sleep ();
    display.dispose ();

public void paintControl(PaintEvent event)
 GC gc = event.gc;
 Rectangle rect = shell.getClientArea();
 gc.drawRectangle(rect.x + 10, rect.y + 10, rect.width - 20, rect.height - 20);  
 gc.drawString(resHello.getString("Hello_world"), rect.x + 20, rect.y + 20);

Question by:jdaues
1 Comment
LVL 18

Accepted Solution

bobbit31 earned 800 total points
ID: 7033190
thanks for the points!

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question