public void widgetSelected( SelectionEvent e ) { ColorDialog cd = new ColorDialog( shell ); cd.setText( BaseMessages.getString( PKG, "NotePadDialog.Font.Color.Dialog.Label" ) ); cd.setRGB( wBorderColor.getBackground().getRGB() ); RGB newColor = cd.open(); if ( newColor == null ) { return; } borderColor.dispose(); borderColor = new Color( shell.getDisplay(), newColor ); wBorderColor.setBackground( borderColor ); } } );
public void widgetSelected( SelectionEvent e ) { ColorDialog cd = new ColorDialog( shell ); cd.setText( BaseMessages.getString( PKG, "NotePadDialog.Font.Color.Dialog.Label" ) ); cd.setRGB( wBackGroundColor.getBackground().getRGB() ); RGB newColor = cd.open(); if ( newColor == null ) { return; } bgColor.dispose(); bgColor = new Color( shell.getDisplay(), newColor ); wBackGroundColor.setBackground( bgColor ); refreshTextNote(); } } );
public void widgetSelected( SelectionEvent e ) { ColorDialog cd = new ColorDialog( shell ); cd.setText( BaseMessages.getString( PKG, "NotePadDialog.Font.Color.Dialog.Label" ) ); cd.setRGB( wFontColor.getBackground().getRGB() ); RGB newColor = cd.open(); if ( newColor == null ) { return; } fontColor.dispose(); fontColor = new Color( shell.getDisplay(), newColor ); wFontColor.setBackground( fontColor ); refreshTextNote(); } } );
public void widgetSelected( SelectionEvent arg0 ) { ColorDialog cd = new ColorDialog( shell ); cd.setRGB( props.getBackgroundRGB() ); RGB newbg = cd.open(); if ( newbg != null ) { backgroundRGB = newbg; background.dispose(); background = new Color( display, backgroundRGB ); wBGColor.setBackground( background ); wBGColor.redraw(); } } } );
public void widgetSelected( SelectionEvent arg0 ) { ColorDialog cd = new ColorDialog( shell ); cd.setRGB( props.getTabColorRGB() ); RGB newbg = cd.open(); if ( newbg != null ) { tabColorRGB = newbg; tabColor.dispose(); tabColor = new Color( display, tabColorRGB ); wTabColor.setBackground( tabColor ); wTabColor.redraw(); } } } );
public void widgetSelected( SelectionEvent arg0 ) { ColorDialog cd = new ColorDialog( shell ); cd.setRGB( props.getGraphColorRGB() ); RGB newbg = cd.open(); if ( newbg != null ) { graphColorRGB = newbg; graphColor.dispose(); graphColor = new Color( display, graphColorRGB ); wGrColor.setBackground( graphColor ); wGrColor.redraw(); } } } );
public static Object getColorDialog(ActionContext actionContext){ ColorDialog dialog = new ColorDialog((Shell) actionContext.get("shell")); return dialog; }
private void openColorDialog() { final ColorDialog dialog = new ColorDialog( shell ); dialog.setRGB( rgb ); dialog.open( new DialogCallback() { @Override public void dialogClosed( int returnCode ) { RGB selected = dialog.getRGB(); if( selected != null ) { rgb = selected; updateControls(); } } } ); }
@Override protected Object openDialogBox(Control cellEditorWindow) { ColorDialog dialog = new ColorDialog(cellEditorWindow.getShell()); Object value = getValue(); if (value != null) { dialog.setRGB((RGB) value); } value = dialog.open(); return dialog.getRGB(); }
@Override protected Object openDialogBox(Control cellEditorWindow) { ColorDialog dialog = new ColorDialog(cellEditorWindow.getShell()); Object value = getValue(); if (value != null) { dialog.setRGB((RGB) value); } value = dialog.open(); return dialog.getRGB(); }
public void invokeColorDialog() { ColorDialog colorWindow = new ColorDialog(parent.getShell()); colorWindow.setRGB(int2rgb(intgerCustom)); RGB rgb = colorWindow.open(); if (rgb != null) { intgerCustom = rgb2int(rgb); clickBody(); } } };
@Override public void handleEvent(Event e) { ColorDialog cd = new ColorDialog(composite.getShell()); List<RGB> custom_colours = Utils.getCustomColors(); if ( r >= 0 && g >= 0 && b >= 0 ){ RGB colour = new RGB(r,g,b); custom_colours.remove( colour ); custom_colours.add( 0, colour ); cd.setRGB( colour ); } cd.setRGBs( custom_colours.toArray( new RGB[0])); RGB newColor = cd.open(); if ( newColor == null ){ return; } Utils.updateCustomColors( cd.getRGBs()); newColorChosen(newColor); if (configID != null) { COConfigurationManager.setRGBParameter(configID, newColor.red, newColor.green, newColor.blue); } else { r = newColor.red; g = newColor.green; b = newColor.blue; updateButtonColor(colorChooser.getDisplay(), r, g, b); } newColorSet(newColor); } });
@Override public void clickMenu(int x, int y) { ColorDialog colorWindow = new ColorDialog(parent.getShell()); colorWindow.setRGB(int2rgb(intgerCustom)); RGB rgb = colorWindow.open(); if (rgb != null) { intgerCustom = rgb2int(rgb); selectedItemID = intgerCustom; toolButton.setImage(createColorImage(int2rgb(intgerCustom))); toolButton.redraw(); } } };
/** * Activate the editor for this selector. This causes the color selection * dialog to appear and wait for user input. * * @since 3.2 */ public void open() { ColorDialog colorDialog = new ColorDialog(fButton.getShell()); colorDialog.setRGB(fColorValue); RGB newColor = colorDialog.open(); if (newColor != null) { RGB oldValue = fColorValue; fColorValue = newColor; final Object[] finalListeners = getListeners(); if (finalListeners.length > 0) { PropertyChangeEvent pEvent = new PropertyChangeEvent( this, PROP_COLORCHANGE, oldValue, newColor); for (Object finalListener : finalListeners) { IPropertyChangeListener listener = (IPropertyChangeListener) finalListener; listener.propertyChange(pEvent); } } updateColorImage(); } } }
private void editColor(ColorDefinition definition, Display display) { if (definition == null) return; RGB currentColor = colorRegistry.getRGB(definition.getId()); ColorDialog colorDialog = new ColorDialog(display.getActiveShell()); colorDialog.setRGB(currentColor); RGB selectedColor = colorDialog.open(); if ((selectedColor != null) && (!selectedColor.equals(currentColor))) { setColorPreferenceValue(definition, selectedColor, false); setRegistryValue(definition, selectedColor); refreshElement(definition); } }
/** * Activate the editor for this selector. This causes the color selection * dialog to appear and wait for user input. * * @since 3.2 */ public void open() { ColorDialog colorDialog = new ColorDialog(fButton.getShell()); colorDialog.setRGB(fColorValue); RGB newColor = colorDialog.open(); if (newColor != null) { RGB oldValue = fColorValue; fColorValue = newColor; final Object[] finalListeners = getListeners(); if (finalListeners.length > 0) { PropertyChangeEvent pEvent = new PropertyChangeEvent( this, PROP_COLORCHANGE, oldValue, newColor); for (int i = 0; i < finalListeners.length; ++i) { IPropertyChangeListener listener = (IPropertyChangeListener) finalListeners[i]; listener.propertyChange(pEvent); } } updateColorImage(); } } }
public void mouseDoubleClick(MouseEvent e) { int x = e.x + boxText.getHorizontalPixel(); int y = e.y + boxText.getTopPixel(); int level = -1; for (Box b : visibleBoxes()) if (contains(b.rec,x, y)) if (level < b.level) level = b.level; level++; ColorDialog colorDialog = new ColorDialog(boxText.getShell()); Color oldColor1 = settings.getColor(level); if (oldColor1 != null) colorDialog.setRGB(oldColor1.getRGB()); settings.setColor(level, colorDialog.open()); }
/** * Activate the editor for this selector. This causes the color selection * dialog to appear and wait for user input. * * @since 1.0 */ public void open() { ColorDialog colorDialog = new ColorDialog(fButton.getShell()); colorDialog.setRGB(fColorValue); RGB newColor = colorDialog.open(); if (newColor != null) { RGB oldValue = fColorValue; fColorValue = newColor; final Object[] finalListeners = getListeners(); if (finalListeners.length > 0) { PropertyChangeEvent pEvent = new PropertyChangeEvent( this, PROP_COLORCHANGE, oldValue, newColor); for (int i = 0; i < finalListeners.length; ++i) { IPropertyChangeListener listener = (IPropertyChangeListener) finalListeners[i]; listener.propertyChange(pEvent); } } updateColorImage(); } } }
public static Object openColorDialog(final ActionContext actionContext){ final Thing self = (Thing) actionContext.get("self"); Shell shell = (Shell) self.doAction("getShell", actionContext); final ColorDialog dialog = new ColorDialog(shell); if(self.getStringBlankAsNull("text") != null){ dialog.setText(self.getString("text")); } if(SwtUtils.isRWT()) { SwtUtils.openDialog(dialog, new DialogCallback() { @Override public void dialogClosed(int returnCode) { if(returnCode == SWT.OK) { self.doAction("open", actionContext, UtilMap.toMap("color", dialog.getRGB())); }else { self.doAction("open", actionContext, "color", null); } } }, actionContext); return null; }else { RGB rgb = dialog.open(); self.doAction("open", actionContext, UtilMap.toMap("color", rgb)); return rgb; } }
private void selectColor (boolean background) { try { ColorDialog dlg = new ColorDialog(getShell()); if ( background ) { dlg.setRGB(opt.background.getRGB()); dlg.setText("Select Background Color"); } else { dlg.setRGB(opt.foreground.getRGB()); dlg.setText("Select Text Color"); } // Open the selection dialog RGB rgb = dlg.open(); if ( rgb == null ) return; // If no user cancellation we set the new color if ( background ) { opt.background.dispose(); opt.background = new Color(getDisplay(), rgb); edExample.setBackground(opt.background); } else { opt.foreground.dispose(); opt.foreground = new Color(getDisplay(), rgb); edExample.setForeground(opt.foreground); } } catch ( Throwable e ) { Dialogs.showError(getShell(), e.getLocalizedMessage(), null); } }