SWT windowbuilder color not show on label etc only composite [message #1386644] |
Thu, 19 June 2014 04:41 |
charlie schindler Messages: 28 Registered: June 2014 |
Junior Member |
|
|
I created a SWT Dialog put 2 tabs inside and composites within the tab
now added a Label and a Combo and wanted to color them, neither fore- nor backend color show up.
Using a Jpanel and then using comboBox the coloring works.
I tried many different things none made the color appear...
Here the code for SWT controls complete code in attached file
CTabItem tabItem_3 = new CTabItem(patientDataTab, SWT.NONE);
tabItem_3.setImage(SWTResourceManager.getImage(patientForm.class,
"/com/sun/java/swing/plaf/windows/icons/NewFolder.gif"));
tabItem_3.setText("New Item");
composite_1 = new Composite(patientDataTab, SWT.NONE);
composite_1.setForeground(SWTResourceManager.getColor(SWT.COLOR_YELLOW));
composite_1.setBackgroundMode(SWT.INHERIT_FORCE);
composite_1.setBackground(SWTResourceManager.getColor(0, 206, 209));
tabItem_3.setControl(composite_1);
formToolkit.paintBordersFor(composite_1);
composite_1.setLayout(new GridLayout(10, false));
Label genderLabel = new Label(composite_1, SWT.NONE);
genderLabel.setBackgroundImage(null);
genderLabel.setBackground(SWTResourceManager.getColor(SWT.COLOR_CYAN));
genderLabel.setAlignment(SWT.RIGHT);
genderLabel.setDragDetect(false);
genderLabel.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLUE));
genderLabel.setBounds(0, 0, 55, 15);
formToolkit.adapt(genderLabel, true, true);
genderLabel.setText(Messages.getString(
"patientForm.lblNewLabel.text", "Gender")); //$NON-NLS-1$ //$NON-NLS-2$
combo = new Combo(composite_1, SWT.NONE);
combo.setBackground(SWTResourceManager.getColor(245, 222, 179));
combo.setItems(new String[] { "male", "female", "unknown" });
GridData gd_combo = new GridData(SWT.FILL, SWT.CENTER, false, false, 2,
1);
gd_combo.widthHint = 124;
combo.setLayoutData(gd_combo);
formToolkit.adapt(combo);
formToolkit.paintBordersFor(combo);
combo.setText(Messages.getString("patientForm.combo.text_1","select gender"));
new Label(composite_1, SWT.NONE);
new Label(composite_1, SWT.NONE);
new Label(composite_1, SWT.NONE);
new Label(composite_1, SWT.NONE);
new Label(composite_1, SWT.NONE);
new Label(composite_1, SWT.NONE);
new Label(composite_1, SWT.NONE);
composite_1.setTabList(new Control[] { genderLabel, combo });
m_bindingContext = initDataBindings();
Note: background color on SWT composite works...
removing the composite has no effect on colors
What is wrong?
[Updated on: Thu, 19 June 2014 13:52] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03596 seconds