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(); } } );
super( parent, checkStyle( parent, style ) ); checkSubclass(); setText( RWTMessages.getMessage( "RWT_ColorDialogTitle" ) );
dialog.setRGBs(colorDialogCustomColors); dialog.setText (ControlExample.getResourceString("Title")); RGB result = dialog.open (); textWidget.append (ControlExample.getResourceString("ColorDialog") + Text.DELIMITER);
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); } }
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; } }