Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 177082 Details for
Bug 323236
[Canvas][GC] Unable to clear the drawing with "empty" paint listener
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Snippet to reproduce
ApplicationTesterEntryPoint.java (text/plain), 2.46 KB, created by
Ivan Furnadjiev
on 2010-08-20 07:51:55 EDT
(
hide
)
Description:
Snippet to reproduce
Filename:
MIME Type:
Creator:
Ivan Furnadjiev
Created:
2010-08-20 07:51:55 EDT
Size:
2.46 KB
patch
obsolete
>package rap.bugs.entrypoint; > >import org.eclipse.rwt.lifecycle.IEntryPoint; >import org.eclipse.swt.SWT; >import org.eclipse.swt.events.MouseEvent; >import org.eclipse.swt.events.MouseListener; >import org.eclipse.swt.events.PaintEvent; >import org.eclipse.swt.events.PaintListener; >import org.eclipse.swt.graphics.GC; >import org.eclipse.swt.layout.FillLayout; >import org.eclipse.swt.widgets.Canvas; >import org.eclipse.swt.widgets.Composite; >import org.eclipse.swt.widgets.Display; >import org.eclipse.swt.widgets.Shell; > >public class ApplicationTesterEntryPoint implements IEntryPoint { > > private boolean draw = true; > > private void createContents( final Composite parent ) { > parent.setLayout( new FillLayout() ); > final Canvas canvas = new Canvas( parent, SWT.NONE ); > canvas.addPaintListener( new PaintListener() { > > public void paintControl( final PaintEvent event ) { > if( draw ) { > int x = 20, y = 20, w = 120, h = 60; > GC gc = event.gc; > gc.setForeground( canvas.getDisplay().getSystemColor( SWT.COLOR_BLUE ) ); > gc.setLineWidth( 10 ); > int[] caps = { > SWT.CAP_FLAT, SWT.CAP_ROUND, SWT.CAP_SQUARE > }; > for( int i = 0; i < caps.length; i++ ) { > gc.setLineCap( caps[ i ] ); > gc.drawLine( x, y, x + w, y ); > y += 20; > } > int[] joins = { > SWT.JOIN_BEVEL, SWT.JOIN_MITER, SWT.JOIN_ROUND > }; > for( int i = 0; i < joins.length; i++ ) { > gc.setLineJoin( joins[ i ] ); > gc.drawPolygon( new int[]{ > x, y, x + w / 2, y + h, x + w, y > } ); > y += h + 20; > } > } > } > } ); > canvas.addMouseListener( new MouseListener() { > > public void mouseDoubleClick( final MouseEvent e ) { > } > > public void mouseDown( final MouseEvent e ) { > draw = !draw; > canvas.redraw(); > } > > public void mouseUp( final MouseEvent e ) { > } > } ); > } > > public int createUI() { > Display display = new Display(); > Shell shell = new Shell( display ); > shell.setText( "Application Tester" ); > createContents( shell ); > shell.setSize( 1280, 600 ); > shell.setLocation( 20, 20 ); > shell.open(); > while( !shell.isDisposed() ) { > if( !display.readAndDispatch() ) { > display.sleep(); > } > } > display.dispose(); > return 0; > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 323236
: 177082