Solved

new interface (for bobbit31)

Posted on 2002-05-24
1
165 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
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 …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

747 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

16 Experts available now in Live!

Get 1:1 Help Now