Solved

new interface (for bobbit31)

Posted on 2002-05-24
1
183 Views
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 ();
    }
    red.dispose();
    display.dispose ();
 }

public void paintControl(PaintEvent event)
{
 GC gc = event.gc;
 gc.setForeground(red);
 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);
}

}
0
Comment
Question by:jdaues
1 Comment
 
LVL 18

Accepted Solution

by:
bobbit31 earned 200 total points
ID: 7033190
thanks for the points!
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
xampp tool 12 47
oracle 11g 23 73
difference of if loops 23 49
mysql jsp example issue 32 32
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
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 will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to implement Singleton Design Pattern in Java.

813 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now