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


Java HtmlColors.getColorString方法代码示例

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


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

示例1: updateColor

import chatty.gui.HtmlColors; //导入方法依赖的package包/类
private void updateColor() {
    Color color = currentUser.getColor();
    Color correctedColor = currentUser.getCorrectedColor();
    
    String colorNamed = HtmlColors.getNamedColorString(color);
    String correctedColorNamed = HtmlColors.getNamedColorString(correctedColor);
    
    String colorCode = HtmlColors.getColorString(color);
    String correctedColorCode = HtmlColors.getColorString(correctedColor);
    
    String colorText;
    String colorTooltipText;

    if (currentUser.hasCustomColor()) {
        Color plainColor = currentUser.getPlainColor();
        colorText = "Color: "+colorNamed+"**";
        colorTooltipText = "Custom Color: "+colorCode
                +" (Original: "+HtmlColors.getNamedColorString(plainColor)+"/"
                + HtmlColors.getColorString(plainColor)+")";
    } else if (currentUser.hasDefaultColor()) {
        colorText = "Color: "+colorNamed+"*";
        colorTooltipText = "Color: "+colorCode+" (default)";
    } else if (currentUser.hasCorrectedColor() && !colorCode.equals(correctedColorCode)) {
        colorText = "Color: "+correctedColorNamed+" ("+colorNamed+")";
        colorTooltipText = "Corrected Color: "+correctedColorCode
                +" (Original: "+colorNamed+"/"+colorCode+")";
    } else {
        colorText = "Color: "+colorNamed;
        colorTooltipText = "Color: "+colorCode;
    }
    colorInfo.setText(colorText);
    colorInfo.setToolTipText(colorTooltipText);
}
 
开发者ID:chatty,项目名称:chatty,代码行数:34,代码来源:InfoPanel.java

示例2: getTableCellRendererComponent

import chatty.gui.HtmlColors; //导入方法依赖的package包/类
@Override
public Component getTableCellRendererComponent(JTable table,
        Object value, boolean isSelected, boolean hasFocus,
        int row, int column) {
    
    // Just return if null
    if (value == null) {
        return this;
    }
    
    // Set text color
    Color color = (Color) value;
    setForeground(color);
    
    // Set text and tooltip text
    String namedColorString = HtmlColors.getNamedColorString(color);
    String colorString = HtmlColors.getColorString(color);
    setText(namedColorString);
    if (namedColorString.equals(colorString)) {
        setToolTipText(colorString);
    } else {
        setToolTipText(namedColorString+" ("+colorString+")");
    }
    
    // Set background color based on selection status
    if (isSelected) {
        setBackground(table.getSelectionBackground());
    } else {
        setBackground(backgroundColor);
    }
    return this;
}
 
开发者ID:chatty,项目名称:chatty,代码行数:33,代码来源:ItemColorEditor.java

示例3: LinkLabel

import chatty.gui.HtmlColors; //导入方法依赖的package包/类
public LinkLabel(String text, LinkLabelListener listener) {
    this.listener = listener;
    setEditable(false);
    setOpaque(false);
    setContentType("text/html");
    setText(text);
    
    // Set the font based on a JLabel
    this.setFont(label.getFont());
    Font font = label.getFont();
    String bold = font.getStyle() == Font.BOLD ? "bold" : "normal";
    String color = HtmlColors.getColorString(label.getForeground());
    String fontRule = "body { "
            + "font-family: "+font.getFamily()+";"
            + "font-size: "+font.getSize()+";"
            + "font-weight: "+bold+";"
            + "color: "+color+";"
            + "}"
            + "a {"
            + "color: "+LaF.getLinkColor()+";"
            + "}";
    ((HTMLDocument)getDocument()).getStyleSheet().addRule(fontRule);
    
    // Link Listener
    this.addHyperlinkListener(new HyperlinkListener() {

        @Override
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                linkClicked(e.getDescription());
            }
        }
    });
}
 
开发者ID:chatty,项目名称:chatty,代码行数:35,代码来源:LinkLabel.java

示例4: getTableCellRendererComponent

import chatty.gui.HtmlColors; //导入方法依赖的package包/类
@Override
public Component getTableCellRendererComponent(JTable table,
        Object value, boolean isSelected, boolean hasFocus,
        int row, int column) {
    
    // Set text color
    Color color = (Color) value;
    setForeground(color);
    
    // Set text and tooltip text
    String namedColorString = HtmlColors.getNamedColorString(color);
    String colorString = HtmlColors.getColorString(color);
    setText(namedColorString);
    if (namedColorString.equals(colorString)) {
        setToolTipText(colorString);
    } else {
        setToolTipText(namedColorString+" ("+colorString+")");
    }
    
    // Set background color based on selection status
    if (isSelected) {
        setBackground(table.getSelectionBackground());
    } else {
        setBackground(table.getBackground());
    }
    return this;
}
 
开发者ID:partouf,项目名称:Chatty-Twitch-Client,代码行数:28,代码来源:UsercolorEditor.java

示例5: updateColor

import chatty.gui.HtmlColors; //导入方法依赖的package包/类
private void updateColor() {
    Color color = currentUser.getColor();
    Color correctedColor = currentUser.getCorrectedColor();
    
    String colorNamed = HtmlColors.getNamedColorString(color);
    String correctedColorNamed = HtmlColors.getNamedColorString(correctedColor);
    
    String colorCode = HtmlColors.getColorString(color);
    String correctedColorCode = HtmlColors.getColorString(correctedColor);
    
    String colorText;
    String colorTooltipText;

    if (currentUser.hasChangedColor()) {
        Color plainColor = currentUser.getPlainColor();
        colorText = "Color: "+colorNamed+"**";
        colorTooltipText = "Custom Color: "+colorCode
                +" (Original: "+HtmlColors.getNamedColorString(plainColor)+"/"
                + HtmlColors.getColorString(plainColor)+")";
    } else if (currentUser.hasDefaultColor()) {
        colorText = "Color: "+colorNamed+"*";
        colorTooltipText = "Color: "+colorCode+" (default)";
    } else if (currentUser.hasCorrectedColor() && !colorCode.equals(correctedColorCode)) {
        colorText = "Color: "+correctedColorNamed+" ("+colorNamed+")";
        colorTooltipText = "Corrected Color: "+correctedColorCode
                +" (Original: "+colorNamed+"/"+colorCode+")";
    } else {
        colorText = "Color: "+colorNamed;
        colorTooltipText = "Color: "+colorCode;
    }
    colorInfo.setText(colorText);
    colorInfo.setToolTipText(colorTooltipText);
}
 
开发者ID:pokemane,项目名称:TwitchChatClient,代码行数:34,代码来源:UserInfo.java


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