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 ); } } );
@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); } });
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 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 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 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(); } } } );
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 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(); } } };
@Override void changeFontOrColor(int index) { switch (index) { case LINK_FOREGROUND_COLOR: { Color oldColor = linkForegroundColor; if (oldColor == null) oldColor = link1.getLinkForeground(); colorDialog.setRGB(oldColor.getRGB()); RGB rgb = colorDialog.open(); if (rgb == null) return; oldColor = linkForegroundColor; linkForegroundColor = new Color (display, rgb); setLinkForeground (); if (oldColor != null) oldColor.dispose (); } break; default: super.changeFontOrColor(index); } }
/** * 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(); } } }
/** * 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 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()); }
public static void editButtonAction(ActionContext actionContext){ Combo colorText = (Combo) actionContext.get("colorText"); Shell shell = (Shell) PoolableControlFactory.borrowControl(colorText.getShell(), "xworker.swt.widgets.ColorDialog", actionContext); //shell.setLocation(text.getLocation().x, text.getLocation().y); ActionContainer ac = (ActionContainer) shell.getData("actions"); ColorDialog dialog = (ColorDialog) ac.doAction("getColorDialog"); //dialog.setl int[] rgb = UtilSwt.parseRGB(colorText.getText()); if(rgb != null){ dialog.setRGB(new RGB(rgb[0], rgb[1], rgb[2])); } //dialog. RGB colorRgb = dialog.open(); if(colorRgb != null){ String rgbStr = UtilSwt.RGBToString(colorRgb); colorText.setText("\"" + rgbStr + "\""); //UtilSwt.setBackground(text, text.getText(), null); } colorText.setFocus(); }
public static void editButtonAction(ActionContext actionContext){ Combo colorText = (Combo) actionContext.get("colorText"); Shell shell = (Shell) PoolableControlFactory.borrowControl(colorText.getShell(), "xworker.swt.widgets.ColorDialog", actionContext); //shell.setLocation(text.getLocation().x, text.getLocation().y); ActionContainer ac = (ActionContainer) shell.getData("actions"); ColorDialog dialog = (ColorDialog) ac.doAction("getColorDialog"); //dialog.setl int[] rgb = UtilSwt.parseRGB(colorText.getText()); if(rgb != null){ dialog.setRGB(new RGB(rgb[0], rgb[1], rgb[2])); } //dialog. RGB colorRgb = dialog.open(); if(colorRgb != null){ String rgbStr = UtilSwt.RGBToString(colorRgb); colorText.setText("\"" + rgbStr + "\""); //UtilSwt.setBackground(text, text.getText(), null); } colorText.setFocus(); }