Java 类org.eclipse.swt.widgets.ColorDialog 实例源码

项目:Hydrograph    文件:HeaderAndDataFormattingDialog.java   
private void addSelectionListeneronButton(Button button, TableEditor editor) {
    button.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            ColorDialog dlg = new ColorDialog(Display.getCurrent().getActiveShell());
            dlg.setRGB(new RGB(0, 0, 0));
            RGB rgb = dlg.open();
            if (rgb != null) {
                Color color = new Color(shell.getDisplay(), rgb);
                String colorValue = convertRGBToHEX(rgb);
                editor.getItem().setText(1, colorValue);
                color.dispose();
            }
        }
    });
}
项目:TuxGuitar-1.3.1-fork    文件:TGMatrixConfig.java   
private void addListeners(){
    this.button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            ColorDialog dlg = new ColorDialog(ButtonColor.this.button.getShell());
            dlg.setRGB(ButtonColor.this.value);
            dlg.setText(TuxGuitar.getProperty("choose-color"));
            RGB result = dlg.open();
            if (result != null) {
                ButtonColor.this.loadColor(result);
            }
        }
    });
    this.button.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            ButtonColor.this.disposeColor();
        }
    });
}
项目:TuxGuitar-1.3.1-fork    文件:StylesOption.java   
private void addListeners(){
    this.button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            if(StylesOption.this.initialized){
                ColorDialog dlg = new ColorDialog(getShell());
                dlg.setRGB(ButtonColor.this.value);
                dlg.setText(TuxGuitar.getProperty("choose-color"));
                RGB result = dlg.open();
                if (result != null) {
                    ButtonColor.this.loadColor(result);
                }
            }
        }
    });
    this.button.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            ButtonColor.this.disposeColor();
        }
    });
}
项目:TuxGuitar-1.3.1-fork    文件:TGFretBoardConfig.java   
private void addListeners(){
    this.button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            ColorDialog dlg = new ColorDialog(ButtonColor.this.button.getShell());
            dlg.setRGB(ButtonColor.this.value);
            dlg.setText(TuxGuitar.getProperty("choose-color"));
            RGB result = dlg.open();
            if (result != null) {
                ButtonColor.this.loadColor(result);
            }
        }
    });
    this.button.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            ButtonColor.this.disposeColor();
        }
    });
}
项目:TuxGuitar-1.3.1-fork    文件:TGPianoConfig.java   
private void addListeners(){
    this.button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            ColorDialog dlg = new ColorDialog(ButtonColor.this.button.getShell());
            dlg.setRGB(ButtonColor.this.value);
            dlg.setText(TuxGuitar.getProperty("choose-color"));
            RGB result = dlg.open();
            if (result != null) {
                ButtonColor.this.loadColor(result);
            }
        }
    });
    this.button.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            ButtonColor.this.disposeColor();
        }
    });
}
项目:triquetrum    文件:EditorUtils.java   
/**
 * Opens a dialog to change the color.
 *
 * @param color
 *          the color to change
 * @return the changed color
 */
public static String editColor(Diagram diagram, String colorStr) {
  Color color = null;
  if (colorStr == null) {
    color = Graphiti.getGaService().manageColor(diagram, IColorConstant.BLACK);
  } else {
    color = EditorUtils.buildColorFromString(diagram, colorStr);
  }
  ColorDialog colorDialog = new ColorDialog(Display.getDefault().getActiveShell());
  colorDialog.setText("Choose color");
  colorDialog.setRGB(new RGB(color.getRed(), color.getGreen(), color.getBlue()));

  RGB retRgb = colorDialog.open();
  if (retRgb == null) {
    return colorStr;
  } else {
    return EditorUtils.toString(retRgb);
  }
}
项目:SecureBPMN    文件:SampleUtil.java   
/**
 * Opens a dialog to change the color.
 * 
 * @param color
 *            the color to change
 * @return the changed color
 */
public static Color editColor(Color color) {
    if (color != null && color.eContainer() instanceof Diagram) {
        Shell shell = getShell();
        ColorDialog colorDialog = new ColorDialog(shell);
        colorDialog.setText("Choose Color");
        colorDialog.setRGB(new RGB(color.getRed(), color.getGreen(), color.getBlue()));

        RGB retRgb = colorDialog.open();
        if (retRgb == null) {
            return null;
        }

        Diagram diagram = (Diagram) color.eContainer();
        Color newColor = Graphiti.getGaService().manageColor(diagram, retRgb.red, retRgb.green, retRgb.blue);
        return newColor;

    }

    return null;
}
项目:gama    文件:BoxDecoratorImpl.java   
@Override
public void mouseDoubleClick(final MouseEvent e) {
    final int x = e.x + boxText.getHorizontalPixel();
    final int y = e.y + boxText.getTopPixel();

    int level = -1;
    for (final Box b : visibleBoxes()) {
        if (contains(b.rec, x, y)) {
            if (level < b.level) {
                level = b.level;
            }
        }
    }
    level++;

    final ColorDialog colorDialog = new ColorDialog(boxText.getShell());
    final Color oldColor1 = settings.getColor(level);
    if (oldColor1 != null) {
        colorDialog.setRGB(oldColor1.getRGB());
    }

    settings.setColor(level, colorDialog.open());
}
项目:translationstudio8    文件:ColorPicker.java   
public ColorPicker(Composite parent, final Color originalColor) {
    super(parent, SWT.SHADOW_OUT);
    if (originalColor == null) throw new IllegalArgumentException("null");
    this.selectedColor = originalColor;
    setImage(getColorImage(originalColor));
    addMouseListener(
            new MouseAdapter() {
                @Override
                public void mouseDown(MouseEvent e) {
                    ColorDialog dialog = new ColorDialog(new Shell(Display.getDefault(), SWT.SHELL_TRIM));
                    dialog.setRGB(selectedColor.getRGB());
                    RGB selected = dialog.open();
                    if (selected != null) {
                        update(selected);
                    }
                }
            });
}
项目:gef-gwt    文件:ColorSelector.java   
/**
 * 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();
    }
}
项目:tmxeditor8    文件:ColorPicker.java   
public ColorPicker(Composite parent, final Color originalColor) {
    super(parent, SWT.SHADOW_OUT);
    if (originalColor == null) throw new IllegalArgumentException("null");
    this.selectedColor = originalColor;
    setImage(getColorImage(originalColor));
    addMouseListener(
            new MouseAdapter() {
                @Override
                public void mouseDown(MouseEvent e) {
                    ColorDialog dialog = new ColorDialog(new Shell(Display.getDefault(), SWT.SHELL_TRIM));
                    dialog.setRGB(selectedColor.getRGB());
                    RGB selected = dialog.open();
                    if (selected != null) {
                        update(selected);
                    }
                }
            });
}
项目:totallicks-tuxguitar    文件:MatrixConfig.java   
private void addListeners(){
    this.button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            ColorDialog dlg = new ColorDialog(ButtonColor.this.button.getShell());
            dlg.setRGB(ButtonColor.this.value);
            dlg.setText(TuxGuitar.getProperty("choose-color"));
            RGB result = dlg.open();
            if (result != null) {
                ButtonColor.this.loadColor(result);
            }
        }
    });
    this.button.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            ButtonColor.this.disposeColor();
        }
    });
}
项目:totallicks-tuxguitar    文件:FretBoardConfig.java   
private void addListeners(){
    this.button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            ColorDialog dlg = new ColorDialog(ButtonColor.this.button.getShell());
            dlg.setRGB(ButtonColor.this.value);
            dlg.setText(TuxGuitar.getProperty("choose-color"));
            RGB result = dlg.open();
            if (result != null) {
                ButtonColor.this.loadColor(result);
            }
        }
    });
    this.button.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            ButtonColor.this.disposeColor();
        }
    });
}
项目:totallicks-tuxguitar    文件:PianoConfig.java   
private void addListeners(){
    this.button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            ColorDialog dlg = new ColorDialog(ButtonColor.this.button.getShell());
            dlg.setRGB(ButtonColor.this.value);
            dlg.setText(TuxGuitar.getProperty("choose-color"));
            RGB result = dlg.open();
            if (result != null) {
                ButtonColor.this.loadColor(result);
            }
        }
    });
    this.button.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            ButtonColor.this.disposeColor();
        }
    });
}
项目:totallicks-tuxguitar    文件:StylesOption.java   
private void addListeners(){
    this.button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            if(StylesOption.this.initialized){
                ColorDialog dlg = new ColorDialog(getShell());
                dlg.setRGB(ButtonColor.this.value);
                dlg.setText(TuxGuitar.getProperty("choose-color"));
                RGB result = dlg.open();
                if (result != null) {
                    ButtonColor.this.loadColor(result);
                }
            }
        }
    });
    this.button.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            ButtonColor.this.disposeColor();
        }
    });
}
项目:cogtool    文件:DefaultInteraction.java   
/**
 * Open up a widget color wheel with the specified title.
 * Should be platform specific.
 * the specified integer should be in the following format.
 * lowest order 8 bits red
 * middle order 8 bits green
 * highest order 8 bits blue
 * ie: xxxxxxxx xxxxxxxx  xxxxxxxx
 *     BLUE     GREEN     RED
 */
public Integer selectColor(int oldColor, String dialogTitle)
{
    RGB old = GraphicsUtil.getRGBFromColor(oldColor);

    // Open the platform specific color chooser
    ColorDialog dialog = new ColorDialog(window);
    dialog.setRGB(old);
    if (dialogTitle != null)
    {
        dialog.setText(dialogTitle);
    }
    RGB newColor = dialog.open();

    if (newColor != null) {
        return new Integer(GraphicsUtil.getColorFromRGB(newColor));
    }

    return null;
}
项目:pmTrans    文件:EditingPane.java   
public void changeBackgroundColor() {
    ColorDialog cd = new ColorDialog(getShell());
    cd.setRGB(text.getBackground().getRGB());
    cd.setText("Choose a color");

    RGB newColor = cd.open();
    if (newColor != null)
        Config.getInstance().setValue(Config.BACKGROUND_COLOR,
                new Color(Display.getCurrent(), newColor));
    updateFont();
}
项目:pmTrans    文件:EditingPane.java   
public void changeFontColor() {
    ColorDialog cd = new ColorDialog(getShell());
    cd.setRGB(text.getBackground().getRGB());
    cd.setText("Choose a color");

    RGB newColor = cd.open();
    if (newColor != null)
        Config.getInstance().setValue(Config.FONT_COLOR,
                new Color(Display.getCurrent(), newColor));
    updateFont();
}
项目:team-explorer-everywhere    文件:HTMLEditor.java   
/**
 * Opens a dialog to let the user pick a color.
 *
 * @param shell
 *        the shell on which to open the dialog (must not be
 *        <code>null</code>)
 * @param initialColor
 *        the initial color to set in the dialog, or <code>null</code> to
 *        use the dialog default
 * @return the color the user picked, or <code>null</code> if the dialog was
 *         cancelled
 */
public String pickColor(final Shell shell, final RGB initialColor) {
    Check.notNull(shell, "shell"); //$NON-NLS-1$

    /*
     * Mac OS X is Extremely Weird Here!
     *
     * On Mac OS X, we open the ColorDialog and it's automatically hooked
     * into the selection in Safari! Changing colors in the dialog while
     * it's open immediately changes the color in the document, before the
     * dialog even closes (we're blocking in this method). We always get
     * null back from dialog.open() when the dialog is closed, so we don't
     * set anything in the document, but that's OK because Safari is
     * magically updating its document for us. Very weird!
     */

    final ColorDialog dialog = new ColorDialog(shell);

    if (initialColor != null) {
        dialog.setRGB(initialColor);
    }

    final RGB rgb = dialog.open();
    if (rgb != null) {
        return String.format("#%1$02x%2$02x%3$02x", rgb.red, rgb.green, rgb.blue); //$NON-NLS-1$
    }
    return null;
}
项目:TranskribusSwtGui    文件:BindColorToButtonListener.java   
private void updatePropertyFromWidget() {
    ColorDialog cd = new ColorDialog(Display.getCurrent().getActiveShell());
    cd.setText("Choose color");
    cd.setRGB(getValueOfProperty().getRGB());
    RGB newColor = cd.open();
    if (newColor == null)
        return;

    try {
        BeanUtils.setProperty(bean, property, Colors.createColor(newColor));
    } catch (IllegalAccessException | InvocationTargetException e) {
        throw new RuntimeException(e);
    }   
}
项目:ForgedUI-Eclipse    文件:ColorCellEditor2.java   
protected Object openDialogBox(Control cellEditorWindow) {
    ColorDialog dialog = new ColorDialog(cellEditorWindow.getShell());
       Object value = getValue();
       if (value != null) {
        dialog.setRGB((RGB) value);
    }
       value = dialog.open();
       RGB rgb = dialog.getRGB();//return the same if cancelled
       if (rgb != null){
        return rgb;//rgbToString(rgb);
       }
       return null;
}
项目:swtUI4    文件:LayoutUtils.java   
protected static void doChangeColor(Shell s) {
    // TODO Auto-generated method stub
    ColorDialog d = new ColorDialog(s, SWT.PRIMARY_MODAL);
    RGB rgb = d.open();
    System.out.println(rgb.toString());
    if (null != rgb) {
        Color c = SWTResourceManager.getColor(rgb);
        backColortarget = c;
        PropertiesUtil.setProperty("rgbRed", backColortarget.getRed() + "");
        PropertiesUtil.setProperty("rgbGree", backColortarget.getGreen() + "");
        PropertiesUtil.setProperty("rgbBlue", backColortarget.getBlue() + "");
        if (null != compList && compList.size() > 0) {
            for (Composite cd : compList) {
                cd.setBackground(c);
                Control[] cts = cd.getChildren();
                if (cts.length > 0) {
                    for (Control cs : cts) {
                        if (cs instanceof CLabel) {
                            cs.setBackground(c);
                        }
                    }
                }
            }
        }
    }

}
项目:scouter    文件:SetColorAction.java   
public void run() {
    if (window != null) {
        ColorDialog dlg = new ColorDialog(window.getShell());
        AgentObject agent = AgentModelThread.getInstance().getAgentObject(objHash);
        dlg.setRGB(agent.getColor().getRGB());
        dlg.setText("Choose a Color");
        RGB rgb = dlg.open();
        if (rgb != null) {
            Color color = AgentColorManager.getInstance().changeColor(objHash, rgb);
            //agent.setColor(color);
        }
    }
}
项目:org.csstudio.display.builder    文件:RGBCellEditor.java   
/** Opens the color dialog. */
@Override
public void activate()
{
    final ColorDialog dialog = new ColorDialog(shell);
    if (value != null)
        dialog.setRGB(value);
    value = dialog.open();
    if (value != null)
        fireApplyEditorValue();
}
项目:ldparteditor    文件:OptionsDesign.java   
@Override
public void mouseDoubleClick(MouseEvent e) {
    final TreeItem selection;
    if (tree.getSelectionCount() == 1 && (selection = tree.getSelection()[0]).getData() != null) {
        ColorDialog dlg = new ColorDialog(getShell());
        // Change the title bar text
        dlg.setText(selection.getText(0));
        dlg.setRGB(selection.getParent().getMapInv().get(selection).getBackground(1).getRGB());
        // Open the dialog and retrieve the selected color
        RGB rgb = dlg.open();
        if (rgb != null) {
            GColour refCol = new GColour(-1, rgb.red / 255f, rgb.green / 255f, rgb.blue / 255f, 1f);
            tree.getMapInv().get(selection).setBackground(1, SWTResourceManager.getColor(rgb));
            Object[] colourObj = (Object[]) selection.getData();
            ColourType type = (ColourType) colourObj[0];
            switch (type) {
            case OPENGL_COLOUR:
                ((float[]) ((Object[]) colourObj[1])[0])[0] = refCol.getR();
                ((float[]) ((Object[]) colourObj[1])[1])[0] = refCol.getG();
                ((float[]) ((Object[]) colourObj[1])[2])[0] = refCol.getB();
                break;
            case SWT_COLOUR:
                ((Color[]) colourObj[1])[0] = SWTResourceManager.getColor(rgb) ;
                break;
            default:
                break;
            }

            for (EditorTextWindow w : Project.getOpenTextWindows()) {
                for (CTabItem t : w.getTabFolder().getItems()) {
                    ((CompositeTab) t).updateColours();
                }
            }
            tree.build();
            tree.update();
        }
    }
}
项目:gama    文件:GamaColorMenu.java   
public static void openView(final IColorRunnable runnable, final RGB initial) {
    final Shell shell = new Shell(WorkbenchHelper.getDisplay(), SWT.MODELESS);
    final ColorDialog dlg = new ColorDialog(shell, SWT.MODELESS);
    dlg.setText("Choose a custom color");
    dlg.setRGB(initial);
    final RGB rgb = dlg.open();
    // final int a = StringUtils.INDEX_NOT_FOUND;
    if (rgb != null) {
        if (runnable != null) {
            runnable.run(rgb.red, rgb.green, rgb.blue);
        }
    }
}
项目:gef-gwt    文件:ColorCellEditor.java   
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();
  }
项目:elexis-3-core    文件:DecoratedStringChooser.java   
public DecoratedStringChooser(Composite parent, final Settings cfg,
    final DecoratedString[] strings){
    super(parent, SWT.BORDER);

    int num = strings.length;
    int typRows = ((int) Math.sqrt(num));
    int typCols = typRows + (num - (typRows * typRows));
    if (typCols < 4) {
        typCols = 4;
    }
    setLayout(new GridLayout(typCols, true));
    Label expl = new Label(this, SWT.WRAP);
    expl.setText(Messages.DecoratedStringChooser_howToChange); //$NON-NLS-1$
    expl.setLayoutData(SWTHelper.getFillGridData(typCols, false, 1, false));
    for (int i = 0; i < num; i++) {
        Label lab = new Label(this, SWT.NONE);
        lab.setText(strings[i].getText());
        String coldesc = cfg.get(strings[i].getText(), "FFFFFF"); //$NON-NLS-1$
        Color background = UiDesk.getColorFromRGB(coldesc);
        lab.setBackground(background);
        GridData gd = new GridData(GridData.FILL_BOTH);
        lab.setLayoutData(gd);
        lab.addMouseListener(new MouseAdapter() {

            @Override
            public void mouseDoubleClick(MouseEvent e){
                ColorDialog cd = new ColorDialog(getShell());
                Label l = (Label) e.getSource();
                RGB selected = cd.open();
                if (selected != null) {
                    String symbolic = UiDesk.createColor(selected);
                    l.setBackground(UiDesk.getColorFromRGB(symbolic));
                    cfg.set(l.getText(), symbolic);
                }
            }

        });
    }
}
项目:parabuild-ci    文件:SWTOtherEditor.java   
/**
 * Creates a new instance.
 * 
 * @param parent  the parent.
 * @param style  the style.
 * @param chart  the chart.
 */
public SWTOtherEditor(Composite parent, int style, JFreeChart chart)
{
    super(parent, style);
    FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 4;
    setLayout(layout);

    Group general = new Group(this, SWT.NONE);
    general.setLayout(new GridLayout(3, false));
    general.setText(localizationResources.getString("General"));

    // row 1: antialiasing
    antialias = new Button(general, SWT.CHECK);
    antialias.setText(localizationResources.getString("Draw_anti-aliased"));
    antialias.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false,
            3, 1));
    antialias.setSelection(chart.getAntiAlias());

    //row 2: background paint for the chart
    new Label(general, SWT.NONE).setText(localizationResources.getString(
            "Background_paint"));
    backgroundPaintCanvas = new SWTPaintCanvas(general, SWT.NONE, 
            SWTUtils.toSwtColor(getDisplay(), chart.getBackgroundPaint()));
    GridData bgGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    bgGridData.heightHint = 20;
    backgroundPaintCanvas.setLayoutData(bgGridData);
    Button selectBgPaint = new Button(general, SWT.PUSH);
    selectBgPaint.setText(localizationResources.getString("Select..."));
    selectBgPaint.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false,
            false));
    selectBgPaint.addSelectionListener(
            new SelectionAdapter() {
                public void widgetSelected(SelectionEvent event) {
                    ColorDialog dlg = new ColorDialog(getShell());
                    dlg.setText(localizationResources.getString(
                            "Background_paint"));
                    dlg.setRGB(backgroundPaintCanvas.getColor().getRGB());
                    RGB rgb = dlg.open();
                    if (rgb != null) {
                        backgroundPaintCanvas.setColor(
                                new Color(getDisplay(), rgb));
                    }
                }
            }
    );
}
项目:ccu-historian    文件:SWTOtherEditor.java   
/**
 * Creates a new instance.
 *
 * @param parent  the parent.
 * @param style  the style.
 * @param chart  the chart.
 */
public SWTOtherEditor(Composite parent, int style, JFreeChart chart) {
    super(parent, style);
    FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 4;
    setLayout(layout);

    Group general = new Group(this, SWT.NONE);
    general.setLayout(new GridLayout(3, false));
    general.setText(localizationResources.getString("General"));

    // row 1: antialiasing
    this.antialias = new Button(general, SWT.CHECK);
    this.antialias.setText(localizationResources.getString(
            "Draw_anti-aliased"));
    this.antialias.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true,
            false, 3, 1));
    this.antialias.setSelection(chart.getAntiAlias());

    //row 2: background paint for the chart
    new Label(general, SWT.NONE).setText(localizationResources.getString(
            "Background_paint"));
    this.backgroundPaintCanvas = new SWTPaintCanvas(general, SWT.NONE,
            SWTUtils.toSwtColor(getDisplay(), chart.getBackgroundPaint()));
    GridData bgGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    bgGridData.heightHint = 20;
    this.backgroundPaintCanvas.setLayoutData(bgGridData);
    Button selectBgPaint = new Button(general, SWT.PUSH);
    selectBgPaint.setText(localizationResources.getString("Select..."));
    selectBgPaint.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false,
            false));
    selectBgPaint.addSelectionListener(
            new SelectionAdapter() {
                public void widgetSelected(SelectionEvent event) {
                    ColorDialog dlg = new ColorDialog(getShell());
                    dlg.setText(localizationResources.getString(
                            "Background_paint"));
                    dlg.setRGB(SWTOtherEditor.this.backgroundPaintCanvas
                            .getColor().getRGB());
                    RGB rgb = dlg.open();
                    if (rgb != null) {
                        SWTOtherEditor.this.backgroundPaintCanvas.setColor(
                                new Color(getDisplay(), rgb));
                    }
                }
            }
    );
}
项目:aya-lang    文件:SWTOtherEditor.java   
/**
 * Creates a new instance.
 *
 * @param parent  the parent.
 * @param style  the style.
 * @param chart  the chart.
 */
public SWTOtherEditor(Composite parent, int style, JFreeChart chart) {
    super(parent, style);
    FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 4;
    setLayout(layout);

    Group general = new Group(this, SWT.NONE);
    general.setLayout(new GridLayout(3, false));
    general.setText(localizationResources.getString("General"));

    // row 1: antialiasing
    this.antialias = new Button(general, SWT.CHECK);
    this.antialias.setText(localizationResources.getString(
            "Draw_anti-aliased"));
    this.antialias.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true,
            false, 3, 1));
    this.antialias.setSelection(chart.getAntiAlias());

    //row 2: background paint for the chart
    new Label(general, SWT.NONE).setText(localizationResources.getString(
            "Background_paint"));
    this.backgroundPaintCanvas = new SWTPaintCanvas(general, SWT.NONE,
            SWTUtils.toSwtColor(getDisplay(), chart.getBackgroundPaint()));
    GridData bgGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    bgGridData.heightHint = 20;
    this.backgroundPaintCanvas.setLayoutData(bgGridData);
    Button selectBgPaint = new Button(general, SWT.PUSH);
    selectBgPaint.setText(localizationResources.getString("Select..."));
    selectBgPaint.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false,
            false));
    selectBgPaint.addSelectionListener(
            new SelectionAdapter() {
                public void widgetSelected(SelectionEvent event) {
                    ColorDialog dlg = new ColorDialog(getShell());
                    dlg.setText(localizationResources.getString(
                            "Background_paint"));
                    dlg.setRGB(SWTOtherEditor.this.backgroundPaintCanvas
                            .getColor().getRGB());
                    RGB rgb = dlg.open();
                    if (rgb != null) {
                        SWTOtherEditor.this.backgroundPaintCanvas.setColor(
                                new Color(getDisplay(), rgb));
                    }
                }
            }
    );
}
项目:TuxGuitar-1.3.1-fork    文件:TGTrackPropertiesDialog.java   
private void initTrackInfo(Composite composite,TGTrack track) {
    composite.setLayout(new GridLayout());
    Composite top = new Composite(composite, SWT.NONE);
    top.setLayout(new GridLayout());
    top.setLayoutData(new GridData(SWT.FILL,SWT.TOP,true,true));
    Composite bottom = new Composite(composite, SWT.NONE);
    bottom.setLayout(new GridLayout());
    bottom.setLayoutData(new GridData(SWT.FILL,SWT.BOTTOM,true,true));

    //-----------------------NAME---------------------------------
    Label nameLabel = new Label(top, SWT.NONE);
    nameLabel.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,true));
    nameLabel.setText(TuxGuitar.getProperty("track.name") + ":");

    this.nameText = new Text(top, SWT.BORDER);
    this.nameText.setLayoutData(getAlignmentData(MINIMUM_LEFT_CONTROLS_WIDTH,SWT.FILL));
    this.nameText.setText(track.getName());

    //-----------------------COLOR---------------------------------
    Label colorLabel = new Label(bottom, SWT.NONE);
    colorLabel.setText(TuxGuitar.getProperty("track.color") + ":");
    colorLabel.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,true));

    final Button colorButton = new Button(bottom, SWT.PUSH);
    colorButton.setLayoutData(getAlignmentData(MINIMUM_LEFT_CONTROLS_WIDTH,SWT.FILL));
    colorButton.setText(TuxGuitar.getProperty("choose"));
    colorButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            ColorDialog dlg = new ColorDialog(TGTrackPropertiesDialog.this.dialog);
            dlg.setRGB(TGTrackPropertiesDialog.this.dialog.getDisplay().getSystemColor(SWT.COLOR_BLACK).getRGB());
            dlg.setText(TuxGuitar.getProperty("choose-color"));
            RGB rgb = dlg.open();
            if (rgb != null) {
                TGTrackPropertiesDialog.this.trackColor.setR(rgb.red);
                TGTrackPropertiesDialog.this.trackColor.setG(rgb.green);
                TGTrackPropertiesDialog.this.trackColor.setB(rgb.blue);
                TGTrackPropertiesDialog.this.setButtonColor(colorButton);
            }
        }
    });
    colorButton.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            TGTrackPropertiesDialog.this.disposeButtonColor();
        }
    });
    this.setButtonColor(colorButton);
}
项目:gama    文件:SWTChartEditor.java   
/**
 * Creates a new instance.
 *
 * @param parent
 *            the parent.
 * @param style
 *            the style.
 * @param chart
 *            the chart.
 */
public SWTOtherEditor(final Composite parent, final int style, final JFreeChart chart) {
    super(parent, style);
    final FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 4;
    setLayout(layout);

    final Group general = new Group(this, SWT.NONE);
    general.setLayout(new GridLayout(3, false));
    general.setText("General");

    // row 1: antialiasing
    this.antialias = new Button(general, SWT.CHECK);
    this.antialias.setText("Draw anti-aliased");
    this.antialias.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 3, 1));
    this.antialias.setSelection(chart.getAntiAlias());

    // row 2: background paint for the chart
    new Label(general, SWT.NONE).setText("Background paint");
    this.backgroundPaintCanvas = new SWTPaintCanvas(general, SWT.NONE,
            GraphicsHelper.toSwtColor(getDisplay(), chart.getBackgroundPaint()));
    final GridData bgGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    bgGridData.heightHint = 20;
    this.backgroundPaintCanvas.setLayoutData(bgGridData);
    final Button selectBgPaint = new Button(general, SWT.PUSH);
    selectBgPaint.setText("Select...");
    selectBgPaint.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
    selectBgPaint.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent event) {
            final ColorDialog dlg = new ColorDialog(getShell());
            dlg.setText("Background_paint");
            dlg.setRGB(SWTOtherEditor.this.backgroundPaintCanvas.getColor().getRGB());
            final RGB rgb = dlg.open();
            if (rgb != null) {
                SWTOtherEditor.this.backgroundPaintCanvas.setColor(new Color(getDisplay(), rgb));
            }
        }
    });
}
项目:synergyview    文件:AttributePropertyPage.java   
/**
    * Adds the section details.
    * 
    * @param composite
    *            the composite
    */
   private void addSectionDetails(final Composite composite) {

// Creates a new tab item for session details
GridLayout layout = new GridLayout(2, false);
composite.setLayout(layout);

GridData gridData = new GridData();

// Label for session name field
Label sessionNameLabel = new Label(composite, SWT.NONE);
gridData = new GridData();
gridData.verticalAlignment = SWT.TOP;
gridData.horizontalAlignment = SWT.RIGHT;
sessionNameLabel.setLayoutData(gridData);
sessionNameLabel.setText("Name");

// Session name text field
attributeNameText = new Text(composite, SWT.BORDER);
gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
attributeNameText.setLayoutData(gridData);
attributeModelBindingCtx.bindValue(SWTObservables.observeText(attributeNameText, SWT.Modify), BeansObservables.observeValue(attribute, Attribute.PROP_NAME), new UpdateValueStrategy(UpdateValueStrategy.POLICY_ON_REQUEST), null);

// Label for session details
Label sessionDetailsLabel = new Label(composite, SWT.NONE);
gridData = new GridData();
gridData.verticalAlignment = SWT.TOP;
gridData.horizontalAlignment = SWT.RIGHT;
sessionDetailsLabel.setText("Details");
sessionDetailsLabel.setLayoutData(gridData);

// Session text field
attributeDetailsText = new Text(composite, SWT.WRAP | SWT.BORDER | SWT.MULTI);
gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
gridData.verticalAlignment = SWT.FILL;
gridData.grabExcessVerticalSpace = true;
attributeDetailsText.setLayoutData(gridData);
attributeModelBindingCtx.bindValue(SWTObservables.observeText(attributeDetailsText, SWT.Modify), BeansObservables.observeValue(attribute, Attribute.PROP_DESCRIPTION), new UpdateValueStrategy(UpdateValueStrategy.POLICY_ON_REQUEST), null);

final Label colorLabel = new Label(composite, SWT.NONE);
colorLabel.setText("Color:");
colorLabelColor = new Label(composite, SWT.NONE);
colorLabelColor.setText("                              ");
String[] rgb = attribute.getColorName().split(",");
currentColor = new Color(composite.getDisplay(), new RGB(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]), Integer.parseInt(rgb[2])));
colorLabelColor.setBackground(currentColor);

final Button changeColourButton = new Button(composite, SWT.PUSH | SWT.BORDER);
changeColourButton.setText("Change Colour");
changeColourButton.addSelectionListener(new SelectionAdapter() {
    public void widgetSelected(SelectionEvent e) {
    ColorDialog cd = new ColorDialog(composite.getShell());
    cd.setText("Attribute Colour Dialog");
    cd.setRGB(new RGB(255, 255, 255));
    RGB newColor = cd.open();
    if (newColor != null) {
        if ((selectedColor != null) && !selectedColor.isDisposed()) {
        selectedColor.dispose();
        }
        selectedColor = new Color(composite.getDisplay(), newColor);
        colorLabelColor.setBackground(selectedColor);
    }
    }
});
   }
项目:synergyview    文件:NewAttributeWizardPage.java   
public void createControl(Composite arg0) {
final Composite composite = new Composite(arg0, SWT.NULL);
GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
composite.setLayoutData(gridData);
GridLayout layoutData = new GridLayout(3, false);
composite.setLayout(layoutData);

Label nameLabel = new Label(composite, SWT.NONE);
nameLabel.setText("Name:");

_nameText = new Text(composite, SWT.BORDER);
createControlDecoration(_nameText);

gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.horizontalSpan = 2;
gridData.grabExcessHorizontalSpace = true;
_nameText.setLayoutData(gridData);

Label detailsLabel = new Label(composite, SWT.NONE);
detailsLabel.setText("Details:");
gridData = new GridData();
gridData.verticalAlignment = SWT.TOP;
detailsLabel.setLayoutData(gridData);

_detailsText = new Text(composite, SWT.BORDER | SWT.WRAP | SWT.MULTI);
createControlDecoration(_detailsText);
gridData = new GridData();
gridData.horizontalSpan = 2;
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
gridData.verticalAlignment = SWT.FILL;
gridData.grabExcessVerticalSpace = true;
_detailsText.setLayoutData(gridData);

final Label colorLabel = new Label(composite, SWT.NONE);
colorLabel.setText("Color:");
final Label colorLabelColor = new Label(composite, SWT.NONE);
colorLabelColor.setText("                              ");
_color = new Color(composite.getDisplay(), new RGB(0, 0, 0));
colorLabelColor.setBackground(_color);
_attribute.setColorName(String.format("%d,%d,%d", 0, 0, 0));
final Button changeColourButton = new Button(composite, SWT.PUSH | SWT.BORDER);
changeColourButton.setText("Change Colour");
changeColourButton.addSelectionListener(new SelectionAdapter() {
    public void widgetSelected(SelectionEvent e) {
    ColorDialog cd = new ColorDialog(composite.getShell());
    cd.setText("Attribute Colour Dialog");
    cd.setRGB(new RGB(255, 255, 255));
    RGB newColor = cd.open();
    if (newColor != null) {
        _color.dispose();
        _color = new Color(composite.getDisplay(), newColor);
        colorLabelColor.setBackground(_color);
        _attribute.setColorName(String.format("%d,%d,%d", newColor.red, newColor.green, newColor.blue));
    }
    }
});

setControl(composite);
bindValues();
WizardPageSupport.create(this, _dbc);
   }
项目:APICloud-Studio    文件:ThemePreferencePage.java   
private void createButton(final Table table, final TableItem tableItem, final int index, final RGBa color)
{
    TableEditor editor = new TableEditor(table);
    Button button = new Button(table, SWT.PUSH | SWT.FLAT);
    Image image = createColorImage(table, color);
    button.setImage(image);
    button.pack();
    editor.minimumWidth = button.getSize().x - 4;
    editor.horizontalAlignment = SWT.CENTER;
    editor.setEditor(button, tableItem, index);
    fTableEditors.add(editor);
    button.setData("color", color); //$NON-NLS-1$

    button.addSelectionListener(new SelectionAdapter()
    {
        @Override
        public void widgetSelected(SelectionEvent e)
        {
            ColorDialog colorDialog = new ColorDialog(table.getShell());
            Button self = ((Button) e.widget);
            RGBa theColor = (RGBa) self.getData("color"); //$NON-NLS-1$
            if (theColor == null)
            {
                theColor = color;
            }
            colorDialog.setRGB(theColor.toRGB());
            RGB newRGB = colorDialog.open();
            if (newRGB == null)
            {
                return;
            }
            ThemeRule token = (ThemeRule) tableItem.getData();
            RGBa newColor = new RGBa(newRGB);
            if (index == 1)
            {
                getTheme().updateRule(table.indexOf(tableItem), token.updateFG(newColor));
            }
            else
            {
                getTheme().updateRule(table.indexOf(tableItem), token.updateBG(newColor));
            }
            // Update the image for this button!
            self.setImage(createColorImage(table, newColor));
            self.setData("color", newColor); //$NON-NLS-1$
            tableViewer.refresh();
        }
    });

    // Allow dragging the button out of it's location to remove the fg/bg for the rule!
    Transfer[] types = new Transfer[] { TextTransfer.getInstance() };
    final DragSource source = new DragSource(button, DND.DROP_MOVE);
    source.setTransfer(types);

    source.addDragListener(new DragSourceAdapter()
    {
        public void dragSetData(DragSourceEvent event)
        {
            event.data = "button:" + table.indexOf(tableItem) + ":" + index; //$NON-NLS-1$ //$NON-NLS-2$
        }
    });
}
项目:nabs    文件:SWTOtherEditor.java   
/**
 * Creates a new instance.
 * 
 * @param parent  the parent.
 * @param style  the style.
 * @param chart  the chart.
 */
public SWTOtherEditor(Composite parent, int style, JFreeChart chart)
{
    super(parent, style);
    FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 4;
    setLayout(layout);

    Group general = new Group(this, SWT.NONE);
    general.setLayout(new GridLayout(3, false));
    general.setText(localizationResources.getString("General"));

    // row 1: antialiasing
    antialias = new Button(general, SWT.CHECK);
    antialias.setText(localizationResources.getString("Draw_anti-aliased"));
    antialias.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false,
            3, 1));
    antialias.setSelection(chart.getAntiAlias());

    //row 2: background paint for the chart
    new Label(general, SWT.NONE).setText(localizationResources.getString(
            "Background_paint"));
    backgroundPaintCanvas = new SWTPaintCanvas(general, SWT.NONE, 
            SWTUtils.toSwtColor(getDisplay(), chart.getBackgroundPaint()));
    GridData bgGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    bgGridData.heightHint = 20;
    backgroundPaintCanvas.setLayoutData(bgGridData);
    Button selectBgPaint = new Button(general, SWT.PUSH);
    selectBgPaint.setText(localizationResources.getString("Select..."));
    selectBgPaint.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false,
            false));
    selectBgPaint.addSelectionListener(
            new SelectionAdapter() {
                public void widgetSelected(SelectionEvent event) {
                    ColorDialog dlg = new ColorDialog(getShell());
                    dlg.setText(localizationResources.getString(
                            "Background_paint"));
                    dlg.setRGB(backgroundPaintCanvas.getColor().getRGB());
                    RGB rgb = dlg.open();
                    if (rgb != null) {
                        backgroundPaintCanvas.setColor(
                                new Color(getDisplay(), rgb));
                    }
                }
            }
    );
}
项目:ECG-Viewer    文件:SWTOtherEditor.java   
/**
 * Creates a new instance.
 *
 * @param parent  the parent.
 * @param style  the style.
 * @param chart  the chart.
 */
public SWTOtherEditor(Composite parent, int style, JFreeChart chart) {
    super(parent, style);
    FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 4;
    setLayout(layout);

    Group general = new Group(this, SWT.NONE);
    general.setLayout(new GridLayout(3, false));
    general.setText(localizationResources.getString("General"));

    // row 1: antialiasing
    this.antialias = new Button(general, SWT.CHECK);
    this.antialias.setText(localizationResources.getString(
            "Draw_anti-aliased"));
    this.antialias.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true,
            false, 3, 1));
    this.antialias.setSelection(chart.getAntiAlias());

    //row 2: background paint for the chart
    new Label(general, SWT.NONE).setText(localizationResources.getString(
            "Background_paint"));
    this.backgroundPaintCanvas = new SWTPaintCanvas(general, SWT.NONE,
            SWTUtils.toSwtColor(getDisplay(), chart.getBackgroundPaint()));
    GridData bgGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    bgGridData.heightHint = 20;
    this.backgroundPaintCanvas.setLayoutData(bgGridData);
    Button selectBgPaint = new Button(general, SWT.PUSH);
    selectBgPaint.setText(localizationResources.getString("Select..."));
    selectBgPaint.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false,
            false));
    selectBgPaint.addSelectionListener(
            new SelectionAdapter() {
                public void widgetSelected(SelectionEvent event) {
                    ColorDialog dlg = new ColorDialog(getShell());
                    dlg.setText(localizationResources.getString(
                            "Background_paint"));
                    dlg.setRGB(SWTOtherEditor.this.backgroundPaintCanvas
                            .getColor().getRGB());
                    RGB rgb = dlg.open();
                    if (rgb != null) {
                        SWTOtherEditor.this.backgroundPaintCanvas.setColor(
                                new Color(getDisplay(), rgb));
                    }
                }
            }
    );
}
项目:astor    文件:SWTOtherEditor.java   
/**
 * Creates a new instance.
 *
 * @param parent  the parent.
 * @param style  the style.
 * @param chart  the chart.
 */
public SWTOtherEditor(Composite parent, int style, JFreeChart chart) {
    super(parent, style);
    FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 4;
    setLayout(layout);

    Group general = new Group(this, SWT.NONE);
    general.setLayout(new GridLayout(3, false));
    general.setText(localizationResources.getString("General"));

    // row 1: antialiasing
    this.antialias = new Button(general, SWT.CHECK);
    this.antialias.setText(localizationResources.getString(
            "Draw_anti-aliased"));
    this.antialias.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true,
            false, 3, 1));
    this.antialias.setSelection(chart.getAntiAlias());

    //row 2: background paint for the chart
    new Label(general, SWT.NONE).setText(localizationResources.getString(
            "Background_paint"));
    this.backgroundPaintCanvas = new SWTPaintCanvas(general, SWT.NONE,
            SWTUtils.toSwtColor(getDisplay(), chart.getBackgroundPaint()));
    GridData bgGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    bgGridData.heightHint = 20;
    this.backgroundPaintCanvas.setLayoutData(bgGridData);
    Button selectBgPaint = new Button(general, SWT.PUSH);
    selectBgPaint.setText(localizationResources.getString("Select..."));
    selectBgPaint.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false,
            false));
    selectBgPaint.addSelectionListener(
            new SelectionAdapter() {
                public void widgetSelected(SelectionEvent event) {
                    ColorDialog dlg = new ColorDialog(getShell());
                    dlg.setText(localizationResources.getString(
                            "Background_paint"));
                    dlg.setRGB(SWTOtherEditor.this.backgroundPaintCanvas
                            .getColor().getRGB());
                    RGB rgb = dlg.open();
                    if (rgb != null) {
                        SWTOtherEditor.this.backgroundPaintCanvas.setColor(
                                new Color(getDisplay(), rgb));
                    }
                }
            }
    );
}
项目:group-five    文件:SWTOtherEditor.java   
/**
 * Creates a new instance.
 *
 * @param parent  the parent.
 * @param style  the style.
 * @param chart  the chart.
 */
public SWTOtherEditor(Composite parent, int style, JFreeChart chart) {
    super(parent, style);
    FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 4;
    setLayout(layout);

    Group general = new Group(this, SWT.NONE);
    general.setLayout(new GridLayout(3, false));
    general.setText(localizationResources.getString("General"));

    // row 1: antialiasing
    this.antialias = new Button(general, SWT.CHECK);
    this.antialias.setText(localizationResources.getString(
            "Draw_anti-aliased"));
    this.antialias.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true,
            false, 3, 1));
    this.antialias.setSelection(chart.getAntiAlias());

    //row 2: background paint for the chart
    new Label(general, SWT.NONE).setText(localizationResources.getString(
            "Background_paint"));
    this.backgroundPaintCanvas = new SWTPaintCanvas(general, SWT.NONE,
            SWTUtils.toSwtColor(getDisplay(), chart.getBackgroundPaint()));
    GridData bgGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    bgGridData.heightHint = 20;
    this.backgroundPaintCanvas.setLayoutData(bgGridData);
    Button selectBgPaint = new Button(general, SWT.PUSH);
    selectBgPaint.setText(localizationResources.getString("Select..."));
    selectBgPaint.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false,
            false));
    selectBgPaint.addSelectionListener(
            new SelectionAdapter() {
                public void widgetSelected(SelectionEvent event) {
                    ColorDialog dlg = new ColorDialog(getShell());
                    dlg.setText(localizationResources.getString(
                            "Background_paint"));
                    dlg.setRGB(SWTOtherEditor.this.backgroundPaintCanvas
                            .getColor().getRGB());
                    RGB rgb = dlg.open();
                    if (rgb != null) {
                        SWTOtherEditor.this.backgroundPaintCanvas.setColor(
                                new Color(getDisplay(), rgb));
                    }
                }
            }
    );
}