Java Code Examples for org.eclipse.swt.widgets.Combo#addFocusListener()

The following examples show how to use org.eclipse.swt.widgets.Combo#addFocusListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommitCommentArea.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public ComboBox(Composite composite, String message, String [] options,
        String[] commentTemplates) {
    
    fMessage= message;
    fComments= options;
    fCommentTemplates = commentTemplates;
    
    fCombo = new Combo(composite, SWT.READ_ONLY);
    fCombo.setLayoutData(SWTUtils.createHFillGridData());
    fCombo.setVisibleItemCount(20);
    
    // populate the previous comment list
    populateList();
    
    // We don't want to have an initial selection
    // (see bug 32078: http://bugs.eclipse.org/bugs/show_bug.cgi?id=32078)
    fCombo.addFocusListener(this);
    fCombo.addSelectionListener(this);
}
 
Example 2
Source File: FontDefinitionDialog.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected Control createDialogArea( Composite parent )
{
	GridLayout glContent = new GridLayout( );
	glContent.verticalSpacing = 5;
	glContent.horizontalSpacing = 5;
	glContent.marginHeight = 7;
	glContent.marginWidth = 7;
	glContent.numColumns = 9;

	cmpContent = new Composite( parent, SWT.NONE );
	cmpContent.setLayout( glContent );
	cmpContent.setLayoutData( new GridData( GridData.FILL_BOTH ) );

	Label lblFont = new Label( cmpContent, SWT.NONE );
	GridData gdLFont = new GridData( );
	lblFont.setLayoutData( gdLFont );
	lblFont.setText( Messages.getString( "FontDefinitionDialog.Lbl.Font" ) ); //$NON-NLS-1$

	cmbFontNames = new Combo( cmpContent, SWT.DROP_DOWN | SWT.READ_ONLY );
	GridData gdCMBFontNames = new GridData( GridData.FILL_HORIZONTAL );
	gdCMBFontNames.horizontalSpan = 8;
	cmbFontNames.setLayoutData( gdCMBFontNames );
	cmbFontNames.addSelectionListener( this );
	cmbFontNames.setVisibleItemCount( 30 );

	Label lblSize = new Label( cmpContent, SWT.NONE );
	GridData gdLSize = new GridData( );
	lblSize.setLayoutData( gdLSize );
	lblSize.setText( Messages.getString( "FontDefinitionDialog.Lbl.Size" ) ); //$NON-NLS-1$

	cmbFontSizes = new Combo( cmpContent, SWT.NONE );
	{
		cmbFontSizes.setItems( FONT_SIZE );
		cmbFontSizes.setText( fdCurrent.isSetSize( )
				? String.valueOf( (int) fdCurrent.getSize( ) )
				: ChartUIUtil.FONT_AUTO );
		GridData gdISCFontSizes = new GridData( GridData.FILL_HORIZONTAL );
		gdISCFontSizes.horizontalSpan = 3;
		cmbFontSizes.setLayoutData( gdISCFontSizes );
		cmbFontSizes.addSelectionListener( this );
		cmbFontSizes.addFocusListener( this );
		cmbFontSizes.setVisibleItemCount( 30 );
	}

	Label lblForeground = new Label( cmpContent, SWT.NONE );
	GridData gdLForeground = new GridData( );
	gdLForeground.horizontalSpan = 2;
	gdLForeground.horizontalIndent = 40;
	lblForeground.setLayoutData( gdLForeground );
	lblForeground.setText( Messages.getString( "FontDefinitionDialog.Lbl.Color" ) ); //$NON-NLS-1$

	fccColor = new FillChooserComposite( cmpContent,
			SWT.NONE,
			wizardContext,
			cdCurrent,
			false,
			false,
			true,
			false,
			false,
			false );
	{
		GridData gdFCCColor = new GridData( GridData.FILL_HORIZONTAL );
		gdFCCColor.horizontalSpan = 3;
		fccColor.setLayoutData( gdFCCColor );
		fccColor.addListener( this );
	}

	createFontStylePanel( );

	if ( isAlignmentEnabled )
	{
		createAlignmentPanel( );
	}

	if ( isRotationEnabled )
	{
		createRotationPanel( );
	}
	createPreviewPanel( );
	populateLists( );
	updatePreview( );

	return cmpContent;
}