當前位置: 首頁>>代碼示例>>Java>>正文


Java JComponent.getBackground方法代碼示例

本文整理匯總了Java中javax.swing.JComponent.getBackground方法的典型用法代碼示例。如果您正苦於以下問題:Java JComponent.getBackground方法的具體用法?Java JComponent.getBackground怎麽用?Java JComponent.getBackground使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JComponent的用法示例。


在下文中一共展示了JComponent.getBackground方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getEdgeLabelRendererComponent

import javax.swing.JComponent; //導入方法依賴的package包/類
public <E> Component getEdgeLabelRendererComponent( JComponent vv, Object value, Font font, boolean isSelected, E edge ) {

        super.setForeground( vv.getForeground() );
        if (edge instanceof Exit) {
            Exit exit = (Exit) edge;
            if (exit.isCurrentExit()) {
                setForeground( pickedEdgeLabelColor );
            } else {
                setForeground( unPickedEdgeLabelColor );
            }
        }

        super.setBackground( vv.getBackground() );

        if (font != null) {
            setFont( font );
        } else {
            setFont( vv.getFont() );
        }
        setIcon( null );
        setBorder( noFocusBorder );
        setValue( value );
        return this;
    }
 
開發者ID:lauriholmas,項目名稱:batmapper,代碼行數:25,代碼來源:ExitLabelRenderer.java

示例2: adjustBackground

import javax.swing.JComponent; //導入方法依賴的package包/類
/**
 * Change background of given component to light gray on Mac look and feel
 * when the component is in a tabbed container and its background hasn't been
 * already changed (is instance of UIResource).
 * @param c
 */
static void adjustBackground( JComponent c ) {
    if( !isAquaLaF || useDefaultBackground )
        return;

    if( !isInTabbedContainer(c) )
        return;

    Color currentBackground = c.getBackground();
    if( currentBackground instanceof UIResource ) {
        c.setBackground(UIManager.getColor("NbExplorerView.background"));
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:ViewUtil.java

示例3: paint

import javax.swing.JComponent; //導入方法依賴的package包/類
/**
 * adds painting of overall border
 */
@Override
public void paint(Graphics g, JComponent c) {

    ColorUtil.setupAntialiasing(g);

    Color col = c.getBackground();
    if (col != null) {
        g.setColor (col);
        g.fillRect (0, 0, c.getWidth(), c.getHeight());
    }
    paintOverallBorder(g, c);
    super.paint(g, c);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:NimbusViewTabDisplayerUI.java

示例4: paint

import javax.swing.JComponent; //導入方法依賴的package包/類
/**
 * adds painting of overall border
 */
public void paint(Graphics g, JComponent c) {

    ColorUtil.setupAntialiasing(g);

    Color col = c.getBackground();
    if (col != null) {
        g.setColor (col);
        g.fillRect (0, 0, c.getWidth(), c.getHeight());
    }
    paintOverallBorder(g, c);
    super.paint(g, c);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:GtkViewTabDisplayerUI.java

示例5: apply

import javax.swing.JComponent; //導入方法依賴的package包/類
/** Apply this coloring to component colors/font.
* The underline and strikeThrough line colors have no effect here.
*/
public void apply(JComponent c) {
    // Possibly change font
    if (font != null) {
        if (fontMode == FONT_MODE_DEFAULT) {
            c.setFont(font);

        } else { // non-default font-mode
            Font origFont = c.getFont();
            if (origFont != null) {
                synchronized (cacheLock) {
                    Font f = (Font)fontAndForeColorCache.get(origFont);
                    if (f == null) {
                        f = modifyFont(origFont);
                        fontAndForeColorCache.put(origFont, f);
                    }
                    c.setFont(f);
                }
            }
        }
    }

    // Possibly change fore-color
    if (foreColor != null) {
        if (!hasAlpha(foreColor)) {
            c.setForeground(foreColor);

        } else { // non-default fore color-mode
            Color origForeColor = c.getForeground();
            if (origForeColor != null) {
                synchronized (cacheLock) {
                    Color fc = (Color)fontAndForeColorCache.get(origForeColor);
                    if (fc == null) {
                        fc = modifyForeColor(origForeColor);
                        fontAndForeColorCache.put(origForeColor, fc);
                    }
                    c.setForeground(fc);
                }
            }
        }
    }

    // Possibly change back-color
    if (backColor != null) {
        if (!hasAlpha(backColor)) {
            c.setBackground(backColor);

        } else { // non-default back color-mode
            Color origBackColor = c.getBackground();
            if (origBackColor != null) {
                synchronized (cacheLock) {
                    Color bc = (Color)backColorCache.get(origBackColor);
                    if (bc == null) {
                        bc = modifyBackColor(origBackColor);
                        backColorCache.put(origBackColor, bc);
                    }
                    c.setBackground(bc);
                }
            }
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:65,代碼來源:Coloring.java

示例6: getExtendedCacheKeys

import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
protected Object[] getExtendedCacheKeys(JComponent c) {
    return (c != null)
            ? new Object[] { c.getBackground() }
            : null;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:7,代碼來源:LoweredBorder.java


注:本文中的javax.swing.JComponent.getBackground方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。