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


Java HtmlColors.getNamedColorString方法代码示例

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


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

import chatty.gui.HtmlColors; //导入方法依赖的package包/类
@Override
public String getSearchValueAt(int rowIndex, int columnIndex) {
    if (columnIndex == 0) {
        return get(rowIndex).getId();
    } else {
        return HtmlColors.getNamedColorString(get(rowIndex).getColor());
    }
}
 
开发者ID:chatty,项目名称:chatty,代码行数:9,代码来源:ItemColorEditor.java

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

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

示例6: chooseColorString

import chatty.gui.HtmlColors; //导入方法依赖的package包/类
/**
 * Let the user choose a Color and return a String representation of that
 * Color.
 * 
 * @param type The type of the color to choose ({@code FOREGROUND} or
 * {@code BACKGROUND})
 * @param presetColor The {@code Color} to preset the color to choose with
 * @param secondaryColor The secondary color to be used for the preview
 * @param name The name of the color to choose (a short description)
 * @param text The text to be used for the preview
 * @return A String representation of the chosen Color, or of the preset
 * Color if the dialog was canceled
 * @see chooseColor(int, Color, Color, String, String)
 */
public String chooseColorString(int type, Color presetColor,
        Color secondaryColor, String name, String text) {
    return HtmlColors.getNamedColorString(
            chooseColor(type, presetColor, secondaryColor, name, text));
}
 
开发者ID:chatty,项目名称:chatty,代码行数:20,代码来源:ColorChooser.java


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