java类org.eclipse.swt.graphics.Color的实例源码

DiskMapTab.java 文件源码 项目:AppleCommander 阅读 27 收藏 0 点赞 0 评论 0
/**
 * Construct the DiskMapTab.
 */
public DiskMapTab(CTabFolder tabFolder, FormattedDisk disk) {
    this.disk = disk;

    // these items are reused; need to dispose of them when done!
    freeFill = new Color(tabFolder.getDisplay(), 100,200,100);
    usedFill = new Color(tabFolder.getDisplay(), 200,100,100);
    black = new Color(tabFolder.getDisplay(), 0,0,0);
    gray = new Color(tabFolder.getDisplay(), 50,50,50);

    createDiskMapTab(tabFolder);
}
ProgressBarDialog.java 文件源码 项目:RefDiff 阅读 25 收藏 0 点赞 0 评论 0
private Control createDialogArea(Composite shell) {
       GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    shell.setLayout(layout);

    lblStep = new Label(shell, SWT.NONE);
    lblStep.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
    lblStep.setText("Step 1 / 999");

    lblMessage = new Label(shell, SWT.NONE);
    lblMessage.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
    lblMessage.setText("Idle");

    pbProg = new ProgressBar(shell, SWT.SMOOTH | SWT.INDETERMINATE);
    pbProg.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
    pbProg.setMaximum(1000);
    pbProg.setSelection(0);
    pbProg.setSelection(256);

    final Label lblSeparator = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
    lblSeparator.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

    txtLog = new Text(shell, SWT.MULTI
              | SWT.BORDER
              | SWT.H_SCROLL
              | SWT.V_SCROLL);
    txtLog.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
    txtLog.setEditable(false);
    txtLog.setBackground(new Color(shell.getDisplay(), 10,10,10));
    txtLog.setForeground(new Color(shell.getDisplay(), 200,200,200));

    shell.layout();

    return shell;
}
SWTGraphics.java 文件源码 项目:neoscada 阅读 28 收藏 0 点赞 0 评论 0
@Override
public void setForeground ( final RGB color )
{
    if ( color != null )
    {
        this.gc.setForeground ( (Color)this.resourceManager.get ( ColorDescriptor.createFrom ( color ) ) );
    }
    else
    {
        this.gc.setForeground ( this.gc.getDevice ().getSystemColor ( SWT.COLOR_WIDGET_FOREGROUND ) );
    }
}
ModelFieldLabelProvider.java 文件源码 项目:scanning 阅读 29 收藏 0 点赞 0 评论 0
@Override
public Color getForeground(Object ofield) {
    Color ret = super.getForeground(ofield);
    if (ret!=null) return ret;
    if (ofield instanceof FieldValue && viewer.isValidationError((FieldValue)ofield)) {
        return Display.getDefault().getSystemColor(SWT.COLOR_RED);
    } else {
        return null;
    }
}
DiskMapTab.java 文件源码 项目:applecommander 阅读 27 收藏 0 点赞 0 评论 0
/**
 * 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);
    }
}
SWTResourceManager.java 文件源码 项目:Hydrograph 阅读 31 收藏 0 点赞 0 评论 0
/**
 * Dispose of all the cached {@link Color}'s.
 */
public static void disposeColors() {
    for (Color color : m_colorMap.values()) {
        color.dispose();
    }
    m_colorMap.clear();
}
Colors.java 文件源码 项目:BiglyBT 阅读 21 收藏 0 点赞 0 评论 0
public static Color getSystemColor (Device d, int id) {
    if (Utils.isGTK3) {
        if (id == SWT.COLOR_INFO_BACKGROUND) {
            return ColorCache.getColor(d, 0, 0,0 );
        }
        if (id == SWT.COLOR_INFO_FOREGROUND) {
            return ColorCache.getColor(d, 255, 255,255 );
        }
    }
    return d.getSystemColor(id);
}
TwistieSection.java 文件源码 项目:BiglyBT 阅读 24 收藏 0 点赞 0 评论 0
@Override
public void setBackground(Color color) {
    if (null != label && !label.isDisposed()) {
        label.setBackground(color);
    }

    if (null != content && !content.isDisposed()) {
        content.setBackground(color);
    }

    super.setBackground(color);
}
StyleHandler.java 文件源码 项目:neoscada 阅读 26 收藏 0 点赞 0 评论 0
public Style ( final Image[] images, final Color[] foregroundColor, final Color[] backgroundColor, final Font[] font )
{
    this.images = images;
    this.foregroundColor = foregroundColor;
    this.backgroundColor = backgroundColor;
    this.font = font;
}
EclipseConsoleIO.java 文件源码 项目:gemoc-studio 阅读 24 收藏 0 点赞 0 评论 0
/** deal with not justified and large string
 * this is because large string may block Eclipse UI
 */
protected void safePrint(String message, final Color c, final int style, IProgressMonitor monitor){
    try {
        String justifiedMsg = justifyMessage(message);
        if(justifiedMsg.length() > LARGE_MESSAGE_SIZE){
            // deal with large messages ... chunk the message
            int nbChunk = justifiedMsg.length()/LARGE_MESSAGE_SIZE;
            monitor.beginTask("writing large string to the console", nbChunk+1);
            int start, end= 0;
            for(int i = 0; i< nbChunk; i++){
                start = LARGE_MESSAGE_SIZE*i;
                end = LARGE_MESSAGE_SIZE*i + LARGE_MESSAGE_SIZE;
                changeStream();
                safeChangeStyle(c, style);
                ((IOConsoleOutputStream)getOutputStream()).write(justifiedMsg.substring(start, end));
                monitor.worked(1);
            }
            changeStream();
            safeChangeStyle(c, style);
            ((IOConsoleOutputStream)getOutputStream()).write(justifiedMsg.substring(end, justifiedMsg.length()));
            monitor.done();
        }
        else{
            safeChangeStyle(c, style);
            ((IOConsoleOutputStream)getOutputStream()).write(justifiedMsg);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号