当前位置: 首页>>代码示例>>Java>>正文


Java GC.setForeground方法代码示例

本文整理汇总了Java中org.eclipse.swt.graphics.GC.setForeground方法的典型用法代码示例。如果您正苦于以下问题:Java GC.setForeground方法的具体用法?Java GC.setForeground怎么用?Java GC.setForeground使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.swt.graphics.GC的用法示例。


在下文中一共展示了GC.setForeground方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: render

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
/**
 * 
 */
@Override
public void render(XCalendarFrame frame) {
	// Background
	final GC gc = frame.getGc();
	final XCalendarModel model = popup.getModel();
	final XCalendarTheme theme = model.getTheme();
	final boolean hovered = this.mouse.isEntered();
	int x = bounds.x, y = bounds.y, w = bounds.width, h = bounds.height;
	gc.setBackground(theme.getBackground(true, false, false, hovered));
	gc.fillRoundRectangle(x, y, w, h, theme.getArc(), theme.getArc());

	// Foreground
	String text = chevron_up;
	gc.setForeground(theme.getToolBarBackground(hovered));
	gc.setFont(Fonts.getAwesomeFont()); final Point size = extent(gc, text);
	gc.drawText(text, x + 1 + ((w - size.x) >> 1), y + 1 + ((h - size.y) >> 1));
}
 
开发者ID:nextopcn,项目名称:xcalendar,代码行数:21,代码来源:XCalendarIncrWidget.java

示例2: render

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
/**
 * 
 */
@Override
public void render(XCalendarFrame frame) {
	// Background
	final GC gc = frame.getGc();
	final XCalendarModel model = popup.getModel();
	final XCalendarTheme theme = model.getTheme();
	final boolean hovered = this.mouse.isEntered();
	int x = bounds.x, y = bounds.y, w = bounds.width, h = bounds.height;
	gc.setBackground(theme.getBackground(true, false, false, hovered));
	gc.fillRoundRectangle(x, y, w, h, theme.getArc(), theme.getArc());

	// Foreground
	String text = theme.getHourTheme()[row][col];
	gc.setForeground(theme.getForeground(true, false, true));
	gc.setFont(theme.getFont()); final Point size = extent(gc, text);
	gc.drawText(text, x + 1 + ((w - size.x) >> 1), y + 1 + ((h - size.y) >> 1));
}
 
开发者ID:nextopcn,项目名称:xcalendar,代码行数:21,代码来源:XCalendarHourWidget.java

示例3: drawButtonDown

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
public static void drawButtonDown(GC gc, String text, int textAlign,
    Image image, int imageAlign, int x, int y, int w, int h,
    Color face, Color shadowNormal, int leftMargin, int topMargin) {
  Color prevForeground = gc.getForeground();
  Color prevBackground = gc.getBackground();
  try {
    gc.setBackground(face);
    gc.setForeground(shadowNormal);
    gc.drawRectangle(x, y, w - 1, h - 1);
    gc.fillRectangle(x + 1, y + 1, 1 + leftMargin, h - 2);
    gc.fillRectangle(x + 1, y + 1, w - 2, topMargin + 1);
    gc.setForeground(prevForeground);
    drawTextImage(gc, text, textAlign, image, imageAlign, x + 2
        + leftMargin, y + 2 + topMargin, w - 3 - leftMargin, h - 3
        - topMargin);
  } finally {
    gc.setForeground(prevForeground);
    gc.setBackground(prevBackground);
  }
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:21,代码来源:SWTX.java

示例4: render

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
/**
 * 
 */
@Override
public void render(XCalendarFrame frame) {
	// Background
	final GC gc = frame.getGc();
	final XCalendarModel model = popup.getModel();
	final XCalendarTheme theme = model.getTheme();
	int x = bounds.x, y = bounds.y, w = bounds.width, h = bounds.height;
	gc.setBackground(theme.getBackground(true, false, false, false));
	gc.fillRoundRectangle(x, y, w, h, theme.getArc(), theme.getArc());

	// Foreground
	String text = theme.getDayOfWeekTheme()[col];
	gc.setForeground(theme.getForeground(true, false, true));
	gc.setFont(theme.getBold()); final Point size = extent(gc, text);
	gc.drawText(text, x + 1 + ((w - size.x) >> 1), y + 1 + ((h - size.y) >> 1));
}
 
开发者ID:nextopcn,项目名称:xcalendar,代码行数:20,代码来源:XCalendarTextWidget.java

示例5: render

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
/**
 * 
 */
@Override
public void render(XCalendarFrame frame) {
	// Background
	final GC gc = frame.getGc();
	final boolean hovered = mouse.isEntered();
	final XCalendarModel model = popup.getModel();
	final XCalendarTheme theme = model.getTheme();
	final XVirtualCalendar calendar = model.getCalendar();
	int x = bounds.x, y = bounds.y, w = bounds.width, h = bounds.height;
	gc.setBackground(theme.getBackground(true, false, false, hovered));
	gc.fillRoundRectangle(x, y, w, h, theme.getArc(), theme.getArc());
	
	// Foreground
	String text = model.getState().text(theme, calendar);
	gc.setForeground(theme.getForeground(true, false, true));
	gc.setFont(theme.getBold()); final Point size = extent(gc, text);
	gc.drawText(text, x + 1 + ((w - size.x) >> 1), y + 1 + ((h - size.y) >> 1));
}
 
开发者ID:nextopcn,项目名称:xcalendar,代码行数:22,代码来源:XCalendarSelectWidget.java

示例6: render

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
/**
 * 
 */
@Override
public void render(XCalendarFrame frame) {
	// Background
	final GC gc = frame.getGc();
	final XCalendarModel model = popup.getModel();
	final XCalendarTheme theme = model.getTheme();
	final boolean hovered = this.mouse.isEntered();
	int x = bounds.x, y = bounds.y, w = bounds.width, h = bounds.height;
	gc.setBackground(theme.getBackground(true, false, false, hovered));
	gc.fillRoundRectangle(x, y, w, h, theme.getArc(), theme.getArc());

	// Foreground
	String text = chevron_down;
	gc.setForeground(theme.getToolBarBackground(hovered));
	gc.setFont(Fonts.getAwesomeFont()); final Point size = extent(gc, text);
	gc.drawText(text, x + 1 + ((w - size.x) >> 1), y + 1 + ((h - size.y) >> 1));
}
 
开发者ID:nextopcn,项目名称:xcalendar,代码行数:21,代码来源:XCalendarDecrWidget.java

示例7: render

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
public void render(XCalendar popup, GC gc) {
	final XCalendarModel model = popup.getModel();
	final XCalendarTheme theme = model.getTheme();
	final Transform t = new Transform(gc.getDevice());
	
	//
	try (final XCalendarFrame frame = new XCalendarFrame(gc, t)) {
		//
		Rectangle area = new Rectangle((area = popup.getClientArea()).x, area.y, area.width - 1, area.height - 1);
		gc.setAdvanced(true);
		gc.setAntialias(SWT.ON);
		gc.setBackground(theme.getBackground(true, false, false, false));
		gc.fillRectangle(area); gc.setForeground(theme.getGrid(true)); gc.drawRectangle(area);
		
		List<XCalendarWidget> widgets = popup.getWidgets();
		for(XCalendarWidget widget:widgets) widget.render(frame);
	}
}
 
开发者ID:nextopcn,项目名称:xcalendar,代码行数:19,代码来源:XCalendarDefaultRender.java

示例8: onPaint

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
/**
 * Paint.
 */
protected void onPaint(GC gc) {
	final Rectangle b = getBounds();

	final TestStatus status = counter != null ? counter.getAggregatedStatus() : null;
	if (status != null) {

		final int total = Math.max(expectedTotal, counter.getTotal()); // this is our 100% value
		final int value = counter.getTotal(); // current value
		final int totalPx = b.width;
		final int valuePx = Math.round(totalPx * (((float) value) / ((float) total)));

		gc.setBackground(getColorForStatus(status));
		gc.fillRectangle(0, 0, valuePx, b.height);

		gc.setBackground(getBackground());
		gc.fillRectangle(0 + valuePx, 0, b.width - valuePx, b.height);
	} else {
		// clear
		gc.setBackground(getBackground());
		gc.fillRectangle(b);
	}

	if (counter != null) {
		final FontMetrics fm = gc.getFontMetrics();
		gc.setForeground(getForeground());
		final int pending = expectedTotal > 0 ? expectedTotal - counter.getTotal() : -1;
		gc.drawString(counter.toString(true, pending, SWT.RIGHT),
				4, b.height / 2 - fm.getHeight() / 2 - fm.getDescent(), true);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:34,代码来源:TestProgressBar.java

示例9: drawBox

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
/**
 * Draw a box on the screen.  The shadowed box is only drawn if there is
 * enough space within the box; otherwise, the box is just filled in with
 * the fill color.  Additionally, drawBox ensures that a square is drawn.
 */
protected void drawBox(Rectangle box, GC gc, Color fill, Color outline, Color shadow) {
	if (box.width >= 10 && box.height >= 10) {
		// square the rectangle shape:
		int size = Math.min(box.height, box.width);
		box.height = size + ((box.height - size) / 2);
		box.width = size + ((box.width - size) / 2);
		// offset internal box:
		box.x+= 2;
		box.y+= 2;
		box.width-= 5;
		box.height-= 5;
		// draw!
		gc.setBackground(shadow);
		gc.fillRectangle(box);
		box.x-= 2;
		box.y-= 2;
		gc.setBackground(fill);
		gc.fillRectangle(box);
		gc.setForeground(outline);
		gc.drawRectangle(box);
	} else {
		// just fill:
		gc.setBackground(fill);
		gc.fillRectangle(box);
	}
}
 
开发者ID:marvinmalkowskijr,项目名称:applecommander,代码行数:32,代码来源:DiskMapTab.java

示例10: paint

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
/**
 * Paint the ... guess what!
 */
@Override
public void paint(GC gc) {
	gc.setBackground(getColor(parentScale, siblingScale));
	gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_BLACK));

	gc.fillRectangle(Math.round(x), Math.round(y), Math.round(width), Math.round(height));

	// StackUtils.drawString(gc, title, x, y, width, height, 0);

	gc.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:15,代码来源:StackNode.java

示例11: makePreview

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
public static Image makePreview ( final Display display, final LineAttributes lineAttributes, final Color lineColor, final Point p )
{
    final Image img = new Image ( display, p.x, p.y );

    final GC gc = new GC ( img );
    try
    {
        gc.setForeground ( img.getDevice ().getSystemColor ( SWT.COLOR_WHITE ) );
        gc.setBackground ( img.getDevice ().getSystemColor ( SWT.COLOR_WHITE ) );
        gc.fillRectangle ( 0, 0, p.x, p.y );

        gc.setLineAttributes ( lineAttributes );

        if ( lineColor != null )
        {
            gc.setForeground ( lineColor );
        }

        gc.drawLine ( 0, p.y / 2, p.x, p.y / 2 );
    }
    finally
    {
        gc.dispose ();
    }

    return img;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:28,代码来源:LineInput.java

示例12: drawChart

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
private void drawChart ( final Device device, final GC gc, final double minX, final double maxX, final Calendar startTimestamp, final Calendar endTimestamp )
{
    final Rectangle bounds = device.getBounds ();

    final Color color = new Color ( device, new RGB ( 0, 0, 0 ) );

    final Rectangle drawBounds = new Rectangle ( bounds.x + 10, bounds.y + 10, bounds.width - 20, bounds.height - 20 );
    gc.setForeground ( color );
    gc.drawRectangle ( drawBounds );

    for ( final Map.Entry<String, List<Double>> row : this.values.entrySet () )
    {
        drawRow ( device, gc, row.getKey (), row.getValue (), drawBounds, minX, maxX );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:16,代码来源:PrintProcessor.java

示例13: drawButtonUp

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
public static void drawButtonUp(GC gc, String text, int textAlign,
    Image image, int imageAlign, int x, int y, int w, int h,
    Color face, Color shadowHigh, Color shadowNormal, Color shadowDark,
    int leftMargin, int topMargin) {
  Color prevForeground = gc.getForeground();
  Color prevBackground = gc.getBackground();
  try {
    gc.setBackground(face);
    gc.setForeground(shadowHigh);
    gc.drawLine(x, y, x, y + h - 1);
    gc.drawLine(x, y, x + w - 2, y);
    gc.setForeground(shadowDark);
    gc.drawLine(x + w - 1, y, x + w - 1, y + h - 1);
    gc.drawLine(x, y + h - 1, x + w - 1, y + h - 1);
    gc.setForeground(shadowNormal);
    gc.drawLine(x + w - 2, y + 1, x + w - 2, y + h - 2);
    gc.drawLine(x + 1, y + h - 2, x + w - 2, y + h - 2);
    //
    gc.fillRectangle(x + 1, y + 1, leftMargin, h - 3);
    gc.fillRectangle(x + 1, y + 1, w - 3, topMargin);
    gc.setForeground(prevForeground);
    drawTextImage(gc, text, textAlign, image, imageAlign, x + 1
        + leftMargin, y + 1 + topMargin, w - 3 - leftMargin, h - 3
        - topMargin);
  } finally {
    gc.setForeground(prevForeground);
    gc.setBackground(prevBackground);
  }
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:30,代码来源:SWTX.java

示例14: drawFlatButtonUp

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
public static void drawFlatButtonUp(GC gc, String text, int textAlign,
    Image image, int imageAlign, int x, int y, int w, int h,
    Color face, Color shadowLight, Color shadowNormal, int leftMargin,
    int topMargin) {
  Color prevForeground = gc.getForeground();
  Color prevBackground = gc.getBackground();
  try {
    gc.setForeground(shadowLight);
    gc.drawLine(x, y, x + w - 1, y);
    gc.drawLine(x, y, x, y + h);
    gc.setForeground(shadowNormal);
    gc.drawLine(x + w, y, x + w, y + h);
    gc.drawLine(x + 1, y + h, x + w, y + h);
    //
gc.setBackground(face);
gc.fillRectangle(x + 1, y + 1, leftMargin, h - 1);
gc.fillRectangle(x + 1, y + 1, w - 1, topMargin);
//
    gc.setBackground(face);
    gc.setForeground(prevForeground);
    drawTextImage(gc, text, textAlign, image, imageAlign, x + 1
        + leftMargin, y + 1 + topMargin, w - 1 - leftMargin, h - 1
        - topMargin);
  } finally {
    gc.setForeground(prevForeground);
    gc.setBackground(prevBackground);
  }
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:29,代码来源:SWTX.java

示例15: drawBottomSpace

import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
protected void drawBottomSpace(GC gc) {
  Rectangle r = getClientArea();
  if (m_Model.getRowCount() > 0) {
    r.y = m_Model.getFirstRowHeight()
        + (m_Model.getFixedRowCount() - 1 + m_RowsVisible)
        * m_Model.getRowHeight() + 1;
  }

  gc.setBackground(getBackground());
  gc.fillRectangle(r);
  gc.fillRectangle(getLastColumnRight() + 2, 0, r.width, r.height);

  if (m_Model.getRowCount() > 0) {
    if (flatStyleSpecified)
      // gc.setForeground(this.getBackground());
      gc.setForeground(m_Display
          .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    else
      gc.setForeground(m_Display
          .getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
    // Linke Schattenlinie
    gc.drawLine(0, 0, 0, r.y - 1);
  }

  if (!flatStyleSpecified)
    gc.setForeground(this.getBackground());
  else
    gc.setForeground(m_Display.getSystemColor(SWT.COLOR_WHITE));
  // Untere Abschlusslinie
  gc.drawLine(0, r.y - 1, getLastColumnRight() + 1, r.y - 1);

  // Rechte Abschlusslinie
  gc.drawLine(getLastColumnRight() + 1, 0, getLastColumnRight() + 1,
      r.y - 1);
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:36,代码来源:KTable.java


注:本文中的org.eclipse.swt.graphics.GC.setForeground方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。