Results 1 to 1 of 1
Thread: Using SWT Canvas
-
Using SWT Canvas
Canvas provide a surface for drawing arbitrary graphics. Following example paints a circle on the canvas.
Java Code:final Display display = new Display(); final Shell shell = new Shell(display); shell.addPaintListener(new PaintListener() { public void paintControl(PaintEvent event) { Rectangle rect = shell.getClientArea(); event.gc.drawOval(0, 0, rect.width - 1, rect.height - 1); } }); shell.setBounds(10, 10, 200, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose();
Similar Threads
-
Calling displayable from a canvas class
By Snalk in forum CLDC and MIDPReplies: 0Last Post: 03-29-2008, 12:58 AM -
Canvas rendered over JCombobox menu
By JSK in forum AWT / SwingReplies: 2Last Post: 11-19-2007, 09:00 PM -
Canvas question
By christina in forum Advanced JavaReplies: 1Last Post: 08-03-2007, 08:21 PM
Bookmarks