[jbosside-dev] jface-swt driving me crazy!

Max Rydahl Andersen max.andersen at jboss.com
Fri Oct 27 06:17:30 EDT 2006


Hi,

I'm going crazy how hard it is to put a combobox in a toolbar in eclipse
without it looking bad.

See the attached snapshot where the lower border/pixels of the comboboxes
are missing.

Anyone who got an idea how to make this work !?

here is the relevant code in a subclass of ControlContribution:

	protected Control createControl(Composite parent) {
		Composite panel = new Composite( parent, SWT.NONE );
		panel.setLayout( new GridLayout(2,false) );
		
		if(getLabelText()!=null) {
			Label label = new Label(panel, SWT.None);
			label.setText(getLabelText());
			GridData gd = new GridData();
			gd.horizontalSpan = 1;
			gd.verticalAlignment = GridData.BEGINNING;
			gd.horizontalAlignment = GridData.END;
		}
		comboControl = new Combo( panel, SWT.DROP_DOWN |
(isReadOnly()?SWT.READ_ONLY:SWT.NONE) );
		
		GridData gd = new GridData();
		gd.grabExcessHorizontalSpace = true;
		gd.widthHint = getComboWidth();
		gd.verticalAlignment = GridData.CENTER;
		gd.horizontalAlignment = GridData.END;
		comboControl.setLayoutData( gd );
		
		populateComboBox( comboControl );

		if(getSelectionAdapter()!=null) {
			comboControl.addSelectionListener( getSelectionAdapter() );
		}

		return panel;
	}



-- 
--
Max Rydahl Andersen
callto://max.rydahl.andersen

Hibernate
max at hibernate.org
http://hibernate.org

JBoss a division of Red Hat
max.andersen at jboss.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: comboborder.png
Type: image/png
Size: 5333 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/jbosstools-dev/attachments/20061027/153cb97c/attachment.png 


More information about the jbosstools-dev mailing list