Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.Color


      /* Font */
      cell.setFont(getFont(scoredNews.getNews(), cell.getColumnIndex()));

      /* Foreground */
      Color foreground = getForeground(scoredNews.getNews(), cell.getColumnIndex());

      /* This is required to invalidate + redraw the entire TableItem! */
      if (!OwlUI.isHighContrast()) {
        Item item = (Item) cell.getItem();
        if (item instanceof TableItem)
View Full Code Here


    this.style = style;
    int shellStyle = style & (SWT.ON_TOP | SWT.TOOL);
    this.shell = (display != null) ? new Shell(display, SWT.NO_TRIM | shellStyle) : new Shell(parent, SWT.NO_TRIM | shellStyle);
    this.contents = new Composite(shell, SWT.NONE);

    final Color c = new Color(shell.getDisplay(), 255, 255, 225);
    shell.setBackground(c);
    shell.setForeground(shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
    contents.setBackground(shell.getBackground());
    contents.setForeground(shell.getForeground());

    selectionControls.add(shell);
    selectionControls.add(contents);

    final Listener globalListener = new Listener() {
      public void handleEvent(Event event) {
        Widget w = event.widget;
        for (int i = selectionControls.size() - 1; i >= 0; i--) {
          if (selectionControls.get(i) == w) {
            if ((style & SWT.CLOSE) != 0) {
              for (int j = selectionListeners.size() - 1; j >= 0; j--)
                ((Listener) selectionListeners.get(j)).handleEvent(event);
            } else {
              shell.close();
            }
            event.doit = false;
          }
        }
      }
    };

    shell.addListener(SWT.Show, new Listener() {
      public void handleEvent(Event event) {
        if (!addedGlobalListener) {
          shell.getDisplay().addFilter(SWT.MouseDown, globalListener);
          addedGlobalListener = true;
        }
      }
    });

    shell.addListener(SWT.Hide, new Listener() {
      public void handleEvent(Event event) {
        if (addedGlobalListener) {
          shell.getDisplay().removeFilter(SWT.MouseDown, globalListener);
          addedGlobalListener = false;
        }
      }
    });

    shell.addListener(SWT.Dispose, new Listener() {
      public void handleEvent(Event event) {
        if (addedGlobalListener) {
          shell.getDisplay().removeFilter(SWT.MouseDown, globalListener);
          addedGlobalListener = false;
        }
        c.dispose();
      }
    });
  }
View Full Code Here

        // Color closeFG = shell.getForeground(), closeBG =
        // shell.getBackground();
        // Color closeFG =
        // shell.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY),
        // closeBG = shell.getBackground();
        Color closeFG = shell.getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND), closeBG = shell.getDisplay()
                .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
        final Image closeImage = createCloseImage(shell.getDisplay(), closeBG, closeFG);
        shell.addListener(SWT.Dispose, new Listener() {
          public void handleEvent(Event event) {
            closeImage.dispose();
View Full Code Here

    dialog.setClipBoard(true);
   
    SchedulerEditorFontDialog fd = new SchedulerEditorFontDialog();
      fd.readFontData();
       dialog.getStyledText().setFont(new Font(null, fd.getFontData()));
      dialog.getStyledText().setForeground(new Color(null, fd.getForeGround()));


    dialog.getStyledText().setEditable(bApply);   
    dialog.setVisibleApplyButton(bApply);   
    dialog.setBSaveWindow(true);   
View Full Code Here

        });
    }

    private void setFont(FontData f, RGB foreGround) {
       tSource.setFont(new Font(this.getDisplay(), f));
       tSource.setForeground(new Color(this.getDisplay(), foreGround));   
       }
View Full Code Here

      new Label(s, SWT.NONE);
      final Text t = new Text(s, SWT.BORDER | SWT.WRAP | SWT.MULTI);
     
      t.setText("Sample Text");
        t.setFont(SWTResourceManager.getFont("Courier New", 8, SWT.NORMAL));
        t.setForeground(new Color(d, this.foreGround));
       
        t.setFont(new Font(d, this.fontData));
        t.setForeground(new Color(d, this.foreGround));
       
      GridData gd_t = new GridData(SWT.FILL, SWT.FILL, false, false, 10, 1);
      gd_t.heightHint = 74;
      t.setLayoutData(gd_t);
      new Label(s, SWT.NONE);
      final Button btnChange = new Button(s, SWT.PUSH | SWT.BORDER);
      btnChange.setText("Change Font");
      btnChange.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
          FontDialog fd = new FontDialog(s, SWT.NONE);
          fd.setText("Select Font");
          fd.setRGB(t.getForeground().getRGB());
          fd.setFontList(t.getFont().getFontData());

           FontData newFont = fd.open();
          if(newFont==null)
              return;
          t.setFont(new Font(d, newFont));
          t.setForeground(new Color(d, fd.getRGB()));
         
        }
      });
     
      Button btnSave = new Button(s, SWT.NONE);
      btnSave.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
           saveFontData(t.getFont().getFontData()[0],t.getForeground().getRGB());
           s.dispose();
        }
      });
      btnSave.setText("Save");
     
      Button btnReset = new Button(s, SWT.NONE);
      btnReset.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            t.setFont(new Font(d, fontData));
            t.setForeground(new Color(d, aktForeGround));
        }
      });
      btnReset.setText("Reset");
     
      Button btnCancel = new Button(s, SWT.NONE);
View Full Code Here

    Iterator e = fColorTable.values().iterator();
    while (e.hasNext())
       ((Color) e.next()).dispose();
  }
  public Color getColor(RGB rgb) {
    Color color = (Color) fColorTable.get(rgb);
    if (color == null) {
      color = new Color(Display.getCurrent(), rgb);
      fColorTable.put(rgb, color);
    }
    return color;
  }
View Full Code Here

        if (control instanceof Composite) {
            for (Control child : ((Composite) control).getChildren()) {
                recurseEnable(en, child);
            }
        } else if (control instanceof Label) {
            Color color = enable ? control.getDisplay().getSystemColor(SWT.COLOR_BLACK) : JFaceResources.getColorRegistry().get(JFacePreferences.QUALIFIER_COLOR);
            control.setForeground(color);
        }
    }
View Full Code Here

        Form form = scrolledForm.getForm();
        toolkit.decorateFormHeading(form);
        form.addMessageHyperlinkListener(new MessageHyperlinkAdapter(getEditor()));
        Composite body = form.getBody();

        greyTitleBarColour = new Color(body.getDisplay(), 210, 245, 210);

        // Create controls
        MDSashForm sashForm = new MDSashForm(body, SWT.HORIZONTAL, managedForm);
        sashForm.setSashWidth(6);
        toolkit.adapt(sashForm, false, false);
View Full Code Here

    private Control createResultsTabControl(Composite parent) {
        SashHighlightForm sashForm = new SashHighlightForm(parent, SWT.VERTICAL);
        sashForm.setSashWidth(6);

        ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
        Color sashColor = colorRegistry.get("org.eclipse.ui.workbench.ACTIVE_TAB_HIGHLIGHT_START");
        sashForm.setSashBackground(sashColor);
        sashForm.setSashForeground(sashColor);

        Composite cmpRequired = new Composite(sashForm, SWT.NONE);
        cmpRequired.setLayout(new GridLayout(2, false));
View Full Code Here

TOP

Related Classes of org.eclipse.swt.graphics.Color

Copyright © 2018 www.massapicom. 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.