本文整理汇总了Java中org.eclipse.swt.graphics.GC.getForeground方法的典型用法代码示例。如果您正苦于以下问题:Java GC.getForeground方法的具体用法?Java GC.getForeground怎么用?Java GC.getForeground使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.graphics.GC
的用法示例。
在下文中一共展示了GC.getForeground方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: doPaint
import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
void doPaint(GC gc, ILineRange visibleLines, LineNumberChangeRulerColumn l) {
Color foreground = gc.getForeground();
if (visibleLines != null) {
if (fRevisionPainter.hasInformation())
fRevisionPainter.paint(gc, visibleLines);
else if (fDiffPainter.hasInformation()) // don't paint quick
// diff
// colors if revisions
// are
// painted
fDiffPainter.paint(gc, visibleLines);
}
gc.setForeground(foreground);
if (l.isShowingLineNumbers() || fCharacterDisplay)
doPaintPatch(gc, visibleLines, l);
}
示例3: paint
import org.eclipse.swt.graphics.GC; //导入方法依赖的package包/类
/**
* Paint the ... guess what!
*/
@Override
public void paint(GC gc) {
final Color oldBackground = gc.getBackground();
final Color oldForeground = gc.getForeground();
try {
long value = -1;
int coordinatesSize = 2 * ((dataEnd - dataStart) + 2);
int[] coordinates = new int[coordinatesSize];
coordinates[0] = (int) (linearScale(dataStart, 0, dataSize) * chartWidth);
coordinates[1] = 0;
for (int j = dataStart; j < dataEnd; j++) {
int jj = j - dataStart;
int s = (jj + 1) * 2;
value = data.get(jj);
int pointX = (int) (linearScale(j, 0, dataSize) * chartWidth);
coordinates[s] = pointX;
int pointY = (int) (logScale(value, dataMin, dataMax) * chartHeight);
coordinates[s + 1] = pointY;
}
coordinates[coordinatesSize - 2] = coordinates[coordinatesSize - 4];
coordinates[coordinatesSize - 1] = 0;
gc.setBackground(getColor(totalScale));
gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_BLACK));
gc.fillPolygon(coordinates);
} finally {
gc.setBackground(oldBackground);
gc.setForeground(oldForeground);
}
}
示例4: 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);
}
}
示例5: 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);
}
}