org.eclipse.swt.graphics.GC.setBackground()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(215)

本文整理了Java中org.eclipse.swt.graphics.GC.setBackground()方法的一些代码示例,展示了GC.setBackground()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GC.setBackground()方法的具体详情如下:
包路径:org.eclipse.swt.graphics.GC
类名称:GC
方法名:setBackground

GC.setBackground介绍

[英]Sets the background color. The background color is used for fill operations and as the background color when text is drawn.
[中]设置背景色。背景色用于填充操作,并在绘制文本时用作背景色。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

public void setBackground( int r, int g, int b ) {
 Color color = getColor( r, g, b );
 gc.setBackground( color );
}

代码示例来源:origin: pentaho/pentaho-kettle

return;
gc.setBackground( (Color) object );
gc.fillRectangle( canvas.getClientArea() );
return;

代码示例来源:origin: pentaho/pentaho-kettle

public void setBackground( int r, int g, int b ) {
 Color color = getColor( r, g, b );
 gc.setBackground( color );
}

代码示例来源:origin: pentaho/pentaho-kettle

public void setBackground( EColor color ) {
 gc.setBackground( getColor( color ) );
}

代码示例来源:origin: pentaho/pentaho-kettle

public void setBackground( EColor color ) {
 gc.setBackground( getColor( color ) );
}

代码示例来源:origin: pentaho/pentaho-kettle

gc.setBackground( fore );
gc.fillPolygon( new int[] { mx, my, x3, y3, x4, y4 } );
gc.setBackground( back );

代码示例来源:origin: pentaho/pentaho-kettle

public void switchForegroundBackgroundColors() {
 Color fg = gc.getForeground();
 Color bg = gc.getBackground();
 gc.setForeground( bg );
 gc.setBackground( fg );
}

代码示例来源:origin: pentaho/pentaho-kettle

public void switchForegroundBackgroundColors() {
 Color fg = gc.getForeground();
 Color bg = gc.getBackground();
 gc.setForeground( bg );
 gc.setBackground( fg );
}

代码示例来源:origin: pentaho/pentaho-kettle

public void drawUp( GC gc ) {
 if ( hover_up ) {
  gc.setBackground( gray );
  gc.fillRectangle( size_up );
 }
 gc.drawRectangle( size_up );
 gc.drawText( STRING_UP, size_up.x + 1 + offsetx, size_up.y + 1 + offsety, SWT.DRAW_TRANSPARENT );
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
 public void paintControl( PaintEvent paintEvent ) {
  paintEvent.gc.setBackground( gui.getColorBackground() );
  paintEvent.gc.fillRectangle( 2, 0, control.getBounds().width - 8, control.getBounds().height - 20 );
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void drawPentahoGradient( Display display, GC gc, Rectangle rect, boolean vertical ) {
 if ( !vertical ) {
  gc.setForeground( display.getSystemColor( SWT.COLOR_WIDGET_BACKGROUND ) );
  gc.setBackground( GUIResource.getInstance().getColorPentaho() );
  gc.fillGradientRectangle( rect.x, rect.y, 2 * rect.width / 3, rect.height, vertical );
  gc.setForeground( GUIResource.getInstance().getColorPentaho() );
  gc.setBackground( display.getSystemColor( SWT.COLOR_WIDGET_BACKGROUND ) );
  gc.fillGradientRectangle( rect.x + 2 * rect.width / 3, rect.y, rect.width / 3 + 1, rect.height, vertical );
 } else {
  gc.setForeground( display.getSystemColor( SWT.COLOR_WIDGET_BACKGROUND ) );
  gc.setBackground( GUIResource.getInstance().getColorPentaho() );
  gc.fillGradientRectangle( rect.x, rect.y, rect.width, 2 * rect.height / 3, vertical );
  gc.setForeground( GUIResource.getInstance().getColorPentaho() );
  gc.setBackground( display.getSystemColor( SWT.COLOR_WIDGET_BACKGROUND ) );
  gc.fillGradientRectangle( rect.x, rect.y + 2 * rect.height / 3, rect.width, rect.height / 3 + 1, vertical );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

private void drawVersionWarning( GC gc, Display display ) {
 gc.setBackground( versionWarningBackgroundColor );
 gc.setForeground( new Color( display, 65, 65, 65 ) );
 // gc.fillRectangle(290, 231, 367, 49);
 // gc.drawRectangle(290, 231, 367, 49);
 gc.drawImage( exclamation_image, 304, 243 );
 gc.setFont( devWarningFont );
 gc.drawText( BaseMessages.getString( PKG, "SplashDialog.DevelopmentWarning" ), 335, 241, true );
}

代码示例来源:origin: pentaho/pentaho-kettle

gc.setBackground( gray );
 gc.fillRectangle( Real2Screen( size_oper[nr] ) );
 gc.drawRectangle( Real2Screen( size_oper[nr] ) );
 gc.setBackground( bg );
gc.setBackground( gray );
gc.fillRectangle( Real2Screen( size_cond[nr] ) );
gc.drawRectangle( Real2Screen( size_cond[nr] ) );
gc.setBackground( bg );

代码示例来源:origin: caoxinyu/RedisClient

/**
 * @return the small {@link Image} that can be used as placeholder for missing image.
 */
private static Image getMissingImage() {
  Image image = new Image(Display.getCurrent(), MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE);
  //
  GC gc = new GC(image);
  gc.setBackground(getColor(SWT.COLOR_RED));
  gc.fillRectangle(0, 0, MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE);
  gc.dispose();
  //
  return image;
}
/**

代码示例来源:origin: pentaho/pentaho-kettle

gc.setBackground( bg );
 gc.fillRectangle( LEFT, TOP, area.x, area.y );
   gc.setBackground( red );
   int x_oval = LEFT + MARGIN + str.length() * fontwidth + offset.x;
   int y_oval = TOP + i * ( fontheight + 2 ) + offset.y;
   gc.fillOval( x_oval, y_oval, fontwidth, fontheight );
   gc.setForeground( black );
   gc.setBackground( bg );
 gc.setBackground( lgray );
 gc.fillRectangle( LEFT + MARGIN, 0, area.x, linepos + 1 );
 gc.setBackground( bg );
 gc.setBackground( lgray );
 gc.fillRectangle( 0, TOP, LEFT, area.y );
gc.setBackground( red );
int position = 0;
for ( FixedFileInputField field : fields ) {
 gc.setBackground( blue );
 drawMarker( gc, potential_click, area.y );

代码示例来源:origin: pentaho/pentaho-kettle

private void drawNegated( GC gc, int x, int y, Condition condition ) {
 Color color = gc.getForeground();
 if ( hover_not ) {
  gc.setBackground( gray );
 }
 gc.fillRectangle( Real2Screen( size_not ) );
 gc.drawRectangle( Real2Screen( size_not ) );
 if ( condition.isNegated() ) {
  if ( hover_not ) {
   gc.setForeground( green );
  }
  gc.drawText( STRING_NOT, size_not.x + 5 + offsetx, size_not.y + 2 + offsety, SWT.DRAW_TRANSPARENT );
  gc.drawText( STRING_NOT, size_not.x + 6 + offsetx, size_not.y + 2 + offsety, SWT.DRAW_TRANSPARENT );
  if ( hover_not ) {
   gc.setForeground( color );
  }
 } else {
  if ( hover_not ) {
   gc.setForeground( red );
   gc.drawText( STRING_NOT, size_not.x + 5 + offsetx, size_not.y + 2 + offsety, SWT.DRAW_TRANSPARENT );
   gc.drawText( STRING_NOT, size_not.x + 6 + offsetx, size_not.y + 2 + offsety, SWT.DRAW_TRANSPARENT );
   gc.setForeground( color );
  }
 }
 if ( hover_not ) {
  gc.setBackground( bg );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void paintControl( PaintEvent e ) {
 Point area = getArea();
 if ( area.x == 0 || area.y == 0 ) {
  return; // nothing to do!
 }
 Display disp = shell.getDisplay();
 Image img = getJobImage( disp, area.x, area.y, magnification );
 e.gc.drawImage( img, 0, 0 );
 if ( jobMeta.nrJobEntries() == 0 ) {
  e.gc.setForeground( GUIResource.getInstance().getColorCrystalTextPentaho() );
  e.gc.setBackground( GUIResource.getInstance().getColorBackground() );
  e.gc.setFont( GUIResource.getInstance().getFontMedium() );
  Image pentahoImage = GUIResource.getInstance().getImageJobCanvas();
  int leftPosition = ( area.x - pentahoImage.getBounds().width ) / 2;
  int topPosition = ( area.y - pentahoImage.getBounds().height ) / 2;
  e.gc.drawImage( pentahoImage, leftPosition, topPosition );
 }
 img.dispose();
}

代码示例来源:origin: pentaho/pentaho-kettle

public void paintControl( final PaintEvent event ) {
  if ( transGraph.trans != null && transGraph.trans.isFinished() ) {
   refreshImage( event.gc );
   if ( image != null && !image.isDisposed() ) {
    event.gc.drawImage( image, 0, 0 );
   }
  } else {
   Rectangle bounds = canvas.getBounds();
   if ( bounds.width <= 0 || bounds.height <= 0 ) {
    return;
   }
   event.gc.setForeground( GUIResource.getInstance().getColorWhite() );
   event.gc.setBackground( GUIResource.getInstance().getColorWhite() );
   event.gc.fillRectangle( new Rectangle( 0, 0, bounds.width, bounds.height ) );
   event.gc.setForeground( GUIResource.getInstance().getColorBlack() );
   String metricsMessage =
    BaseMessages.getString( PKG, "TransMetricsDelegate.TransformationIsNotRunning.Message" );
   org.eclipse.swt.graphics.Point extent = event.gc.textExtent( metricsMessage );
   event.gc.drawText( metricsMessage, ( bounds.width - extent.x ) / 2, ( bounds.height - extent.y ) / 2 );
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void paintControl( PaintEvent event ) {
  if ( jobGraph.job != null && ( jobGraph.job.isFinished() || jobGraph.job.isStopped() ) ) {
   refreshImage( event.gc );
   if ( image != null && !image.isDisposed() ) {
    event.gc.drawImage( image, 0, 0 );
   }
  } else {
   Rectangle bounds = canvas.getBounds();
   if ( bounds.width <= 0 || bounds.height <= 0 ) {
    return;
   }
   event.gc.setForeground( GUIResource.getInstance().getColorWhite() );
   event.gc.setBackground( GUIResource.getInstance().getColorWhite() );
   event.gc.fillRectangle( new Rectangle( 0, 0, bounds.width, bounds.height ) );
   event.gc.setForeground( GUIResource.getInstance().getColorBlack() );
   String metricsMessage = BaseMessages.getString( PKG, "JobMetricsDelegate.JobIsNotRunning.Message" );
   org.eclipse.swt.graphics.Point extent = event.gc.textExtent( metricsMessage );
   event.gc.drawText( metricsMessage, ( bounds.width - extent.x ) / 2, ( bounds.height - extent.y ) / 2 );
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

gc.setBackground( white );
gc.setForeground( black );
gc.fillRectangle( 0, 0, width, height );

相关文章

GC类方法