Solved

new interface (for bobbit31)

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
basic hardware to learn oop advanced design patterns 3 88
micro services spring boot application error 3 146
Java Loop 6 49
how to add new optional parameter to JSP 1 29
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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 practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

920 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

15 Experts available now in Live!

Get 1:1 Help Now