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


Java JComponent.getForeground方法代码示例

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


在下文中一共展示了JComponent.getForeground方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: configureEditedComponent

import javax.swing.JComponent; //导入方法依赖的package包/类
private void configureEditedComponent(JComponent c) {
    if(c == null) return;
    if(USE_NEW_ITEM_COLOR_SWITCHING) {
        if(c.getForeground() == Color.LIGHT_GRAY) {
            c.setForeground(getNormalForeground(c));
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:MenuEditLayer.java

示例3: 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


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