itemSet = true; ColorDialog colorDialog= new ColorDialog(itemBackgroundButton.getShell()); colorDialog.setRGB(chosenItemBackgroundColor); RGB newColor = colorDialog.open(); if (newColor != null) { Color oldColor = null; if (itemBackgroundColor != null) oldColor = itemBackgroundColor; itemBackgroundColor = new Color (itemBackgroundButton.getDisplay(), newColor); GC gc = new GC(itemBackgroundImage); gc.setBackground(itemBackgroundColor); gc.fillRectangle(0,0,fontHeight*2-1,fontHeight-1); gc.drawRectangle(0,0,fontHeight*2-1,fontHeight-1); gc.dispose(); itemBackgroundButton.setImage(itemBackgroundImage); chosenItemBackgroundColor = newColor; setItemColors (); if (oldColor != null) oldColor.dispose (); }
RGB rgb = backgroundDialog.open(); if (rgb == null) return; Color oldColor = itemBackgroundColor; itemBackgroundColor = new Color (itemBackgroundButton.getDisplay(), rgb); setItemsBackground (); if (oldColor != null) oldColor.dispose ();
			public void widgetSelected(SelectionEvent event) {				itemSet = true;				ColorDialog colorDialog= new ColorDialog(itemBackgroundButton.getShell());				colorDialog.setRGB(chosenItemBackgroundColor);				RGB newColor = colorDialog.open();				if (newColor != null) {					Color oldColor = null;					if (itemBackgroundColor != null) oldColor = itemBackgroundColor;					itemBackgroundColor = new Color (itemBackgroundButton.getDisplay(), newColor);					GC gc = new GC(itemBackgroundImage);					gc.setBackground(itemBackgroundColor);					gc.fillRectangle(0,0,fontHeight*2-1,fontHeight-1);					gc.drawRectangle(0,0,fontHeight*2-1,fontHeight-1);					gc.dispose();					itemBackgroundButton.setImage(itemBackgroundImage);					chosenItemBackgroundColor = newColor;					setItemColors ();					if (oldColor != null) oldColor.dispose ();				}			}