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 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 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 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); } }
@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); } });
ColorDialog dialog = new ColorDialog (shell ,style); if (usePreviousResultButton.getSelection()) { dialog.setRGB (colorDialogResult); dialog.setRGBs(colorDialogCustomColors); dialog.setText (ControlExample.getResourceString("Title")); RGB result = dialog.open (); textWidget.append (ControlExample.getResourceString("ColorDialog") + Text.DELIMITER); textWidget.append (ControlExample.getResourceString("Result", "" + result) + Text.DELIMITER); textWidget.append ("getRGB() = " + dialog.getRGB() + Text.DELIMITER); textWidget.append ("getRGBs() =" + Text.DELIMITER); RGB[] rgbs = dialog.getRGBs(); if (rgbs != null) { for (RGB rgbColor : rgbs) {
super (parent, checkStyle (parent, style)); checkSubclass ();
super( parent, checkStyle( parent, style ) ); checkSubclass(); setText( RWTMessages.getMessage( "RWT_ColorDialogTitle" ) );
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; } }
public static Object getColorDialog(ActionContext actionContext){ ColorDialog dialog = new ColorDialog((Shell) actionContext.get("shell")); return dialog; }
@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(); }
ColorDialog cd = new ColorDialog(centerShell); cd.setRGB( existing ); cd.setRGBs( custom_colours.toArray( new RGB[0])); RGB rgb = cd.open(); updateCustomColors( cd.getRGBs());
super (parent, checkStyle (parent, style)); checkSubclass ();
colorDialog = new ColorDialog (shell); fontDialog = new FontDialog (shell); colorAndFontTable.addSelectionListener(widgetDefaultSelectedAdapter(event -> changeFontOrColor (colorAndFontTable.getSelectionIndex())));
@Override public void dialogClosed(int returnCode) { RGB colorRgb = dialog.getRGB(); if(colorRgb != null){ String rgbStr = UtilSwt.RGBToString(colorRgb); text.setText(rgbStr); //UtilSwt.setBackground(text, text.getText(), null); } text.setFocus(); }
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 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 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(); }