Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.ColorDialog.open()


          resources.add(customColor);
          resources.add(customImage);
        } else if (customPatternMI == item) {
          FileDialog dialog = new FileDialog(parent.getShell());
          dialog.setFilterExtensions(new String[] { "*.jpg", "*.gif", "*.*" });
          String name = dialog.open();
          if (name == null)
            return;
          if (customColorMI != null)
            customColorMI.setImage(null);
          if (customGradientMI != null)
View Full Code Here


            if (background.getBgColor1() != null)
              dialog.setFirstRGB(background.getBgColor1().getRGB());
            if (background.getBgColor2() != null)
              dialog.setSecondRGB(background.getBgColor2().getRGB());
          }
          if (dialog.open() != SWT.OK)
            return;
          Color colorA = new Color(display, dialog.getFirstRGB());
          Color colorB = new Color(display, dialog.getSecondRGB());
          if (colorA == null || colorB == null)
            return;
View Full Code Here

      FileDialog dialog = new FileDialog(shell, style);
      dialog.setFileName(ControlExample.getResourceString("readme_txt"));
      dialog.setFilterNames(DialogTab.FilterNames);
      dialog.setFilterExtensions(DialogTab.FilterExtensions);
      dialog.setText(ControlExample.getResourceString("Title"));
      String result = dialog.open();
      textWidget.append(ControlExample.getResourceString("FileDialog") + Text.DELIMITER);
      textWidget
          .append(ControlExample.getResourceString("Result", new String[] { "" + result }) + Text.DELIMITER);
      if ((dialog.getStyle() & SWT.MULTI) != 0) {
        String[] files = dialog.getFileNames();
View Full Code Here

    }

    if (name.equals(ControlExample.getResourceString("FontDialog"))) {
      FontDialog dialog = new FontDialog(shell, style);
      dialog.setText(ControlExample.getResourceString("Title"));
      FontData result = dialog.open();
      textWidget.append(ControlExample.getResourceString("FontDialog") + Text.DELIMITER);
      textWidget.append(ControlExample.getResourceString("Result", new String[] { "" + result }) + Text.DELIMITER
          + Text.DELIMITER);
      return;
    }
View Full Code Here

    }

    if (name.equals(ControlExample.getResourceString("PrintDialog"))) {
      PrintDialog dialog = new PrintDialog(shell, style);
      dialog.setText(ControlExample.getResourceString("Title"));
      PrinterData result = dialog.open();
      textWidget.append(ControlExample.getResourceString("PrintDialog") + Text.DELIMITER);
      textWidget.append(ControlExample.getResourceString("Result", new String[] { "" + result }) + Text.DELIMITER
          + Text.DELIMITER);
      return;
    }
View Full Code Here

    if (name.equals(ControlExample.getResourceString("MessageBox"))) {
      MessageBox dialog = new MessageBox(shell, style);
      dialog.setMessage(ControlExample.getResourceString("Example_string"));
      dialog.setText(ControlExample.getResourceString("Title"));
      int result = dialog.open();
      textWidget.append(ControlExample.getResourceString("MessageBox") + Text.DELIMITER);
      /*
       * The resulting integer depends on the original dialog style. Decode the result and display it.
       */
      switch (result) {
View Full Code Here

    if (name.equals(ControlExample.getResourceString("ColorDialog"))) {
      ColorDialog dialog = new ColorDialog(shell, style);
      dialog.setRGB(new RGB(100, 100, 100));
      dialog.setText(ControlExample.getResourceString("Title"));
      RGB result = dialog.open();
      textWidget.append(ControlExample.getResourceString("ColorDialog") + Text.DELIMITER);
      textWidget.append(ControlExample.getResourceString("Result", new String[] { "" + result }) + Text.DELIMITER
          + Text.DELIMITER);
      return;
    }
View Full Code Here

    if (name.equals(ControlExample.getResourceString("DirectoryDialog"))) {
      DirectoryDialog dialog = new DirectoryDialog(shell, style);
      dialog.setMessage(ControlExample.getResourceString("Example_string"));
      dialog.setText(ControlExample.getResourceString("Title"));
      String result = dialog.open();
      textWidget.append(ControlExample.getResourceString("DirectoryDialog") + Text.DELIMITER);
      textWidget.append(ControlExample.getResourceString("Result", new String[] { "" + result }) + Text.DELIMITER
          + Text.DELIMITER);
      return;
    }
View Full Code Here

        fButton.setImage(fImage);
        fButton.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent event) {
                ColorDialog colorDialog = new ColorDialog(fButton.getShell());
                colorDialog.setRGB(fColorValue);
                RGB newColor = colorDialog.open();
                if (newColor != null) {
                    fColorValue = newColor;
                    updateColorImage();
                }
            }
View Full Code Here

  }

  private void onSelectOtherColor() {
    ColorDialog dialog = new ColorDialog(fParent.getShell());
    dialog.setRGB(fSelectedColor);
    RGB color = dialog.open();
    if (color != null)
      onColorSelected(color);
  }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.