CurveFittingViewer cfViewer = new CurveFittingViewer( ); GridLayout gl = new GridLayout( ); gl.numColumns = 1; Display d = Display.getDefault( ); Shell sh = new Shell( d ); sh.setSize( 900, 700 ); sh.setLayout( gl ); sh.setText( cfViewer.getClass( ).getName( ) + " [device=" + cfViewer.idr.getClass( ).getName( ) + "]" );
CurveFittingViewer cfViewer = new CurveFittingViewer( shell, SWT.NO_BACKGROUND ); cfViewer.setLayoutData( new GridData( GridData.FILL_BOTH ) ); cfViewer.addPaintListener( cfViewer );
	public static void main( String[] args )	{		CurveFittingViewer cfViewer = new CurveFittingViewer( );		GridLayout gl = new GridLayout( );		gl.numColumns = 1;		Display d = Display.getDefault( );		Shell sh = new Shell( d );		sh.setSize( 900, 700 );		sh.setLayout( gl );		sh.setText( cfViewer.getClass( ).getName( ) + " [device=" //$NON-NLS-1$				+ cfViewer.idr.getClass( ).getName( ) + "]" );//$NON-NLS-1$		GridData gd = new GridData( GridData.FILL_BOTH );		Canvas cCenter = new Canvas( sh, SWT.NONE );		cCenter.setLayoutData( gd );		cCenter.addPaintListener( cfViewer );		Composite choicePanel = new Composite( sh, SWT.NONE );		gd = new GridData( GridData.FILL_HORIZONTAL );		choicePanel.setLayoutData( gd );		choicePanel.setLayout( new RowLayout( ) );		Label la = new Label( choicePanel, SWT.NONE );		la.setText( "Choose: " );//$NON-NLS-1$		Combo cbType = new Combo( choicePanel, SWT.DROP_DOWN | SWT.READ_ONLY );		cbType.add( "Bar Chart" );//$NON-NLS-1$		cbType.add( "Line Chart" );//$NON-NLS-1$		cbType.add( "Stock Chart" );//$NON-NLS-1$		cbType.add( "Area Chart" );//$NON-NLS-1$		cbType.select( 0 );		Button btn = new Button( choicePanel, SWT.NONE );		btn.setText( "Update" );//$NON-NLS-1$		btn.addSelectionListener( cfViewer );		cfViewer.cb = cbType;		cfViewer.ca = cCenter;		sh.open( );		while ( !sh.isDisposed( ) )		{			if ( !d.readAndDispatch( ) )			{				d.sleep( );			}		}	}