Mega Code Archive

 
Categories / Java Tutorial / SWT 2D Graphics
 

Draw a thick line

import org.eclipse.swt.graphics.GC; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class ThickLinkDraw {   public static void main(String[] args) {     Display display = new Display();     Shell shell = new Shell(display);     shell.open();     GC gc = new GC(shell);     gc.setLineWidth(4);     gc.drawRectangle(20, 20, 100, 100);     gc.dispose();     while (!shell.isDisposed()) {       if (!display.readAndDispatch())         display.sleep();     }     display.dispose();   } }