Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.Color


  public boolean hasKey(String name) {
    return properties.hasKey(name);
  }

  public Color getColor(String name, Color def) {
    Color color = getColor(name);
    if (color == null) {
      return def;
    }
    return color;
  }
View Full Code Here


    } else {
      shareRatio = DisplayFormatters.formatDecimal((double) sr / 1000, 3);
    }
   
    if( cell.setText(shareRatio) && changeFG ) {
      Color color = sr < iMinShareRatio ? Colors.colorWarning : null;
      cell.setForeground(Utils.colorToIntArray(color));
    }
  }
View Full Code Here

    private void changeColor(TableCell cell, Download dl, int iState) {
      try {
        DefaultRankCalculator calc = StartStopRulesDefaultPlugin.getRankCalculator(dl);
       
        Color newFG = null;
        if (calc != null && dl.getState() == Download.ST_SEEDING
            && !calc.getActivelySeeding())
          newFG = Colors.colorWarning;

        cell.setForeground(Utils.colorToIntArray(newFG));
View Full Code Here

     
      TableRow row = cell.getTableRow();
     
      if (row != null ) {
       
        Color color = null;
        if (state == DownloadManager.STATE_SEEDING) {
          color = Colors.blues[Colors.BLUES_MIDDARK];
        } else if (state == DownloadManager.STATE_ERROR) {
          color = Colors.colorError;
        } else {
View Full Code Here

    private void changeColor(TableCell cell, Download dl, int iState) {
      try {
        DefaultRankCalculator calc = StartStopRulesDefaultPlugin.getRankCalculator(dl);
       
        Color newFG = null;
        if (calc != null && dl.getState() == Download.ST_DOWNLOADING
            && !calc.getActivelyDownloading())
          newFG = Colors.colorWarning;

        cell.setForeground(Utils.colorToIntArray(newFG));
View Full Code Here

    }
   
    scale.width = size.width;
    scale.height = size.height;
   
    Color white = ColorCache.getColor(display,255,255,255);
    Color blue = ColorCache.getColor(display,66,87,104);
   
    if (img != null && !img.isDisposed()) {
      img.dispose();
    }
   
    img = new Image(display,size);
   
    GC gc = new GC(img);   
   
    gc.setForeground(white);
    gc.setBackground(white);
   
    gc.fillRectangle(size);
   
    if(SWT.getVersion() >= 3138 && antiAliasingAvailable) {
      try {
        //gc.setTextAntialias(SWT.ON);
        //gc.setAntialias(SWT.ON);
      } catch(Exception e) {
        antiAliasingAvailable = false;
      }
    }
   
   
    gc.setForeground(blue);
    gc.setBackground(white);    
   
    DHTNetworkPosition _ownPosition = self.getNetworkPosition(DHTNetworkPosition.POSITION_TYPE_VIVALDI_V1);

    if ( _ownPosition == null ){
      return;
    }
   
    VivaldiPosition ownPosition = (VivaldiPosition)_ownPosition;
    float ownErrorEstimate = ownPosition.getErrorEstimate();
    HeightCoordinatesImpl ownCoords =
      (HeightCoordinatesImpl) ownPosition.getCoordinates();
   
    gc.drawText("Our error: " + ownErrorEstimate,10,10);
   
    Color black = ColorCache.getColor(display, 0, 0, 0);
    gc.setBackground(black); // Color of the squares

    // Draw all known positions of other contacts
    Iterator iter = contacts.iterator();
    while(iter.hasNext()) {
      DHTControlContact contact = (DHTControlContact) iter.next();
      DHTNetworkPosition _position = contact.getTransportContact().getNetworkPosition(DHTNetworkPosition.POSITION_TYPE_VIVALDI_V1);
      if ( _position == null ){
        continue;
      }
      VivaldiPosition position = (VivaldiPosition)_position;
      HeightCoordinatesImpl coord = (HeightCoordinatesImpl) position.getCoordinates();
      if(coord.isValid()) {
        draw(gc,coord.getX(),coord.getY(),coord.getH(),contact,(int)ownCoords.distance(coord),position.getErrorEstimate());
      }
    }
   
    // Mark our own position
    Color red = ColorCache.getColor(display, 255, 0, 0);
    gc.setForeground(red);
    drawSelf(gc, ownCoords.getX(), ownCoords.getY(),
             ownCoords.getH(), ownErrorEstimate);
   
   
View Full Code Here

    }
   
    img = new Image(display,size);
    GC gc = new GC(img);
   
    Color white = ColorCache.getColor(display,255,255,255);
    gc.setForeground(white);
    gc.setBackground(white);
    gc.fillRectangle(size);
   
    Color blue = ColorCache.getColor(display,66,87,104);
    gc.setForeground(blue);
    gc.setBackground(blue);
   
   
   
    Iterator iter = vivaldiPositions.iterator();
    while(iter.hasNext()) {
      VivaldiPosition position  = (VivaldiPosition)iter.next();
      HeightCoordinatesImpl coord = (HeightCoordinatesImpl) position.getCoordinates();
     
      float error = position.getErrorEstimate() - VivaldiPosition.ERROR_MIN;
      if(error < 0) error = 0;
      if(error > 1) error = 1;
      int blueComponent = (int) (255 - error * 255);
      int redComponent = (int) (255*error);
      // Don't use ColorCache, as our color creation is temporary and
      // varying
      Color drawColor = new Color(display,redComponent,50,blueComponent);     
      gc.setForeground(drawColor);
      draw(gc,coord.getX(),coord.getY(),coord.getH());
      drawColor.dispose();
    }
   
    gc.dispose();
   
    canvas.redraw();
View Full Code Here

      }
    }
    TRTrackerScraperResponse response = dm.getTrackerScrapeResponse();
    if (response instanceof TRTrackerBTScraperResponseImpl) {
      boolean bMultiHashScrapes = ((TRTrackerBTScraperResponseImpl) response).getTrackerStatus().getSupportsMultipeHashScrapes();
      Color color = (bMultiHashScrapes) ? null : Colors.grey;
      cell.setForeground(Utils.colorToIntArray(color));
    }else{
      cell.setForeground(Utils.colorToIntArray(null));
    }
  }
View Full Code Here

        gc.setBackground (GRADIENT_COLOR_1);
        gc.fillGradientRectangle (rect.x, rect.y, rect.width, rect.height, false);
        Image image = SWTImageRepository.getImage(logo_image);
        gc.drawImage(image, rect.width - image.getImageData().width - 10, 5);
       
        gc.setForeground(new Color(SWTThread.getDisplay(),0,0,0));
        Font font = new Font(display,"Arial",14,SWT.NONE );
        gc.setFont(font);
        gc.drawText(JMConstants.JMULE_NAME, 20, TOP_GRADIENT_HEIGHT / 2 - 15,true);
       
        gc.setForeground(new Color(SWTThread.getDisplay(),0,0,0));
        font = new Font(display,"Arial",10,SWT.NONE );
        gc.setFont(font);
        gc.drawText("Version : " + JMConstants.JMULE_VERSION, 17, TOP_GRADIENT_HEIGHT / 2 + 5,true);
      }
    });
View Full Code Here

        String s = text.substring(i, end);
        relStartPos += (end - i);
        lineStartPos += (end - i);
        Point pt = null;
        //System.out.println("|" + s + "|");
        Color fgColor = null;
        if (!noDraw) {
          fgColor = gc.getForeground();
          if (urlInfo.urlColor != null) {
            gc.setForeground(urlInfo.urlColor);
          } else if (urlColor != null) {
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.