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


Java HtmlColors类代码示例

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


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

示例1: getDefaultNotificationSettingValue

import chatty.gui.HtmlColors; //导入依赖的package包/类
/**
 * Used both for creating a default (as the method name would suggest) and
 * setting a value once on version change based on previous settings (note
 * that settings are loaded after the default is set, so that will in turn
 * use the defaults of the referenced settings).
 * 
 * @return 
 */
private List<List> getDefaultNotificationSettingValue() {
    String hl = settings.getString("highlightNotification");
    String st = settings.getString("statusNotification");
    
    Notification.Builder hlNew = new Notification.Builder(Notification.Type.HIGHLIGHT);
    hlNew.setForeground(Color.BLACK);
    hlNew.setBackground(HtmlColors.decode("#FFFF79"));
    hlNew.setDesktopEnabled(convertOldState(hl));
    
    Notification.Builder stNew = new Notification.Builder(Notification.Type.STREAM_STATUS);
    stNew.setForeground(Color.BLACK);
    stNew.setBackground(HtmlColors.decode("#FFFFF0"));
    stNew.setDesktopEnabled(convertOldState(st));
    if (settings.getBoolean("ignoreOfflineNotifications")) {
        stNew.setOptions(Arrays.asList("noOffline"));
    }
    
    List<List> result = new ArrayList<>();
    result.add(new Notification(hlNew).toList());
    result.add(new Notification(stNew).toList());
    return result;
}
 
开发者ID:chatty,项目名称:chatty,代码行数:31,代码来源:SettingsManager.java

示例2: toList

import chatty.gui.HtmlColors; //导入依赖的package包/类
public List toList() {
    List result = new ArrayList<>();
    result.add(type.name());
    result.add(desktopState.id);
    result.add(soundState.id);
    result.add(HtmlColors.getColorString(foregroundColor));
    result.add(HtmlColors.getColorString(backgroundColor));
    result.add(fontSize);
    result.add(options);
    result.add(soundFile);
    result.add(soundVolume);
    result.add(soundCooldown);
    result.add(soundInactiveCooldown);
    result.add(channel);
    result.add(matcher);
    return result;
}
 
开发者ID:chatty,项目名称:chatty,代码行数:18,代码来源:Notification.java

示例3: nick

import chatty.gui.HtmlColors; //导入依赖的package包/类
/**
 * Makes a style for the given User, containing the User-object itself
 * and the user-color. Changes the color to hopefully improve readability.
 * 
 * @param user The User-object to base this style on
 * @param style Attributes to base the user style on
 * @return 
 */
public MutableAttributeSet nick(User user, MutableAttributeSet style) {
    SimpleAttributeSet userStyle;
    if (style == null) {
        userStyle = new SimpleAttributeSet(nick());
        userStyle.addAttribute(Attribute.IS_USER_MESSAGE, true);
        Color userColor = user.getColor();
        // Only correct color if no custom color is defined
        if (!user.hasCustomColor() && isEnabled(Setting.COLOR_CORRECTION)) {
            userColor = HtmlColors.correctReadability(userColor, getBackground());
            user.setCorrectedColor(userColor);
        }
        StyleConstants.setForeground(userStyle, userColor);
    }
    else {
        userStyle = new SimpleAttributeSet(style);
    }
    userStyle.addAttribute(Attribute.USER, user);
    return userStyle;
}
 
开发者ID:chatty,项目名称:chatty,代码行数:28,代码来源:ChannelTextPane.java

示例4: createInfoWindow

import chatty.gui.HtmlColors; //导入依赖的package包/类
/**
 * Creates the window for the info popup. This should only be run once and
 * then reused, only changing the text and size.
 */
private void createInfoWindow() {
    infoWindow = new JWindow(SwingUtilities.getWindowAncestor(textField));
    infoLabel = new JLabel();
    infoWindow.add(infoLabel);
    JPanel contentPane = (JPanel) infoWindow.getContentPane();
    Border border = BorderFactory.createCompoundBorder(
            BorderFactory.createLineBorder(Color.GRAY),
            BorderFactory.createEmptyBorder(2, 4, 2, 4));
    contentPane.setBorder(border);
    contentPane.setBackground(HtmlColors.decode("#EEEEEE"));
    infoLabel.setFont(textField.getFont());

    /**
     * Hide the info popup if the textfield or containing window is changed
     * in any way.
     */
    containingWindow = SwingUtilities.getWindowAncestor(textField);
    if (containingWindow != null) {
        containingWindow.addComponentListener(componentListener);
    }
    textField.addComponentListener(componentListener);
}
 
开发者ID:chatty,项目名称:chatty,代码行数:27,代码来源:AutoCompletion.java

示例5: create

import chatty.gui.HtmlColors; //导入依赖的package包/类
private Notification create() {
    Type type = this.type.getSettingValue();
    Color foreground = HtmlColors.decode(foregroundColor.getSettingValue());
    Color background = HtmlColors.decode(backgroundColor.getSettingValue());
    
    Notification.Builder b = new Notification.Builder(type);
    b.setDesktopEnabled(desktopState.getSettingValue());
    b.setSoundEnabled(soundState.getSettingValue());
    b.setForeground(foreground);
    b.setBackground(background);
    b.setSoundFile(soundFile.getSettingValue());
    b.setVolume(volumeSlider.getSettingValue());
    b.setSoundCooldown(soundCooldown.getSettingValue(0L).intValue());
    b.setSoundInactiveCooldown(soundInactiveCooldown.getSettingValue(0L).intValue());
    b.setChannel(channel.getSettingValue());
    b.setMatcher(matcher.getSettingValue());
    b.setOptions(getSubTypes());
    
    current = new Notification(b);
    return current;
}
 
开发者ID:chatty,项目名称:chatty,代码行数:22,代码来源:NotificationEditor.java

示例6: updated

import chatty.gui.HtmlColors; //导入依赖的package包/类
/**
 * Updates the preview and current Color objects based on the saved colors.
 */
public void updated() {
    // Update Color objects based on current values
    currentColor = HtmlColors.decode(getSettingValue());
    secondaryColor = HtmlColors.decode(baseColor);
    
    // Choose the approriate background/foreground colors depending on type
    Color foregroundColor;
    Color backgroundColor;
    if (type == FOREGROUND) {
        foregroundColor = currentColor;
        backgroundColor = secondaryColor;
    } else {
        foregroundColor = secondaryColor;
        backgroundColor = currentColor;
    }
    //System.out.println(mainColor+" "+secondColor);
    //System.out.println(baseColor);
    preview.setForeground(foregroundColor);
    preview.setBackground(backgroundColor);
}
 
开发者ID:chatty,项目名称:chatty,代码行数:24,代码来源:ColorSetting.java

示例7: nick

import chatty.gui.HtmlColors; //导入依赖的package包/类
/**
 * Makes a style for the given User, containing the User-object itself
 * and the user-color. Changes the color to hopefully improve readability.
 * 
 * @param user The User-object to base this style on
 * @param style Attributes to base the user style on
 * @return 
 */
public MutableAttributeSet nick(User user, MutableAttributeSet style) {
    SimpleAttributeSet userStyle;
    if (style == null) {
        userStyle = new SimpleAttributeSet(nick());
        userStyle.addAttribute(Attribute.USER_MESSAGE, true);
        Color userColor = user.getColor();
        // Only correct color if no custom color is defined
        if (!user.hasCustomColor()) {
            userColor = HtmlColors.correctReadability(userColor, getBackground());
            user.setCorrectedColor(userColor);
        }
        StyleConstants.setForeground(userStyle, userColor);
    }
    else {
        userStyle = new SimpleAttributeSet(style);
    }
    userStyle.addAttribute(Attribute.USER, user);
    return userStyle;
}
 
开发者ID:partouf,项目名称:Chatty-Twitch-Client,代码行数:28,代码来源:ChannelTextPane.java

示例8: nick

import chatty.gui.HtmlColors; //导入依赖的package包/类
/**
 * Makes a style for the given User, containing the User-object itself
 * and the user-color. Changes the color to hopefully improve readability.
 * 
 * @param user The User-object to base this style on
 * @return 
 */
public MutableAttributeSet nick(User user, MutableAttributeSet style) {
    SimpleAttributeSet userStyle;
    if (style == null) {
        userStyle = new SimpleAttributeSet(nick());
        userStyle.addAttribute(CHATTY_USER_MESSAGE, true);
        Color userColor = user.getColor();
        if (!user.hasChangedColor()) {
            userColor = HtmlColors.correctReadability(userColor, getBackground());
            user.setCorrectedColor(userColor);
        }
        StyleConstants.setForeground(userStyle, userColor);
    }
    else {
        userStyle = new SimpleAttributeSet(style);
    }
    userStyle.addAttribute(CHATTY_USER, user);
    return userStyle;
}
 
开发者ID:pokemane,项目名称:TwitchChatClient,代码行数:26,代码来源:ChannelTextPane.java

示例9: getTier

import chatty.gui.HtmlColors; //导入依赖的package包/类
private static CheerEmoticon getTier(String prefix, JSONObject tier, String stream) {
    int min_bits = ((Number)tier.get("min_bits")).intValue();
    Color color = HtmlColors.decode((String)tier.get("color"));
    Set<CheerEmoticonUrl> urls = new HashSet<>();
    JSONObject images = (JSONObject)tier.get("images");
    addUrls(images, urls, "dark", "animated");
    addUrls(images, urls, "dark", "static");
    addUrls(images, urls, "light", "animated");
    addUrls(images, urls, "light", "static");
    
    return CheerEmoticon.create(prefix, min_bits, color, urls, stream);
}
 
开发者ID:chatty,项目名称:chatty,代码行数:13,代码来源:CheerEmoticonManager.java

示例10: fromList

import chatty.gui.HtmlColors; //导入依赖的package包/类
public static Notification fromList(List list) {
    try {
        Type type = Type.valueOf((String)list.get(0));
        State desktopState = State.getTypeFromId(((Number)list.get(1)).intValue());
        State soundState = State.getTypeFromId(((Number)list.get(2)).intValue());
        Color foregroundColor = HtmlColors.decode((String)list.get(3));
        Color backgroundColor = HtmlColors.decode((String)list.get(4));
        int fontSize = ((Number)list.get(5)).intValue();
        List<String> options = getStringList(list.get(6));
        String soundFile = (String)list.get(7);
        long volume = ((Number)list.get(8)).longValue();
        int soundCooldown = ((Number)list.get(9)).intValue();
        int soundInactiveCooldown = ((Number)list.get(10)).intValue();
        String channel = (String)list.get(11);
        String matcher = (String)list.get(12);
        
        Builder b = new Builder(type);
        b.setDesktopEnabled(desktopState);
        b.setSoundEnabled(soundState);
        b.setForeground(foregroundColor);
        b.setBackground(backgroundColor);
        b.setFontSize(fontSize);
        b.setOptions(options);
        b.setSoundFile(soundFile);
        b.setVolume(volume);
        b.setSoundCooldown(soundCooldown);
        b.setSoundInactiveCooldown(soundInactiveCooldown);
        b.setChannel(channel);
        b.setMatcher(matcher);
        return new Notification(b);
    } catch (Exception ex) {
        LOGGER.warning("Error parsing NotificationSettings: "+ex);
    }
    return null;
}
 
开发者ID:chatty,项目名称:chatty,代码行数:36,代码来源:Notification.java

示例11: loadFromSettings

import chatty.gui.HtmlColors; //导入依赖的package包/类
/**
 * Loads the data from the settings, creating {@code Usercolor} objects from
 * the loaded entries.
 * 
 * <p>The items are assumed to be in the format:<br />
 * <code>[id],[color]</code> (the last comma is used as seperating comma,
 * since {@code id} may contain a comma, but {@code color} should not)</p>
 */
private void loadFromSettings() {
    List<String> l = new LinkedList<>();
    settings.getList("usercolors", l);
    List<UsercolorItem> loadedData = new ArrayList<>();
    for (String entry : l) {
        int splitAt = entry.lastIndexOf(",");
        if (splitAt > 0 && entry.length() > splitAt+1) {
            String id = entry.substring(0, splitAt);
            Color color = HtmlColors.decode(entry.substring(splitAt + 1));
            loadedData.add(new UsercolorItem(id, color));
        }
    }
    data = loadedData;
}
 
开发者ID:chatty,项目名称:chatty,代码行数:23,代码来源:UsercolorManager.java

示例12: saveToSettings

import chatty.gui.HtmlColors; //导入依赖的package包/类
/**
 * Copy the current data to the settings.
 */
private void saveToSettings() {
    List<String> dataToSave = new LinkedList<>();
    for (UsercolorItem item : data) {
        dataToSave.add(item.getId()+","+HtmlColors.getColorString(item.getColor()));
    }
    settings.putList("usercolors", dataToSave);
}
 
开发者ID:chatty,项目名称:chatty,代码行数:11,代码来源:UsercolorManager.java

示例13: loadFromSettings

import chatty.gui.HtmlColors; //导入依赖的package包/类
/**
 * Loads the data from the settings, creating {@code Usercolor} objects from
 * the loaded entries.
 * 
 * <p>The items are assumed to be in the format:<br />
 * <code>[id],[color]</code> (the last comma is used as seperating comma,
 * since {@code id} may contain a comma, but {@code color} should not)</p>
 */
private void loadFromSettings() {
    List<String> loadedList = new LinkedList<>();
    settings.getList(DATA_SETTING, loadedList);
    List<MsgColorItem> loadedData = new ArrayList<>();
    for (String entry : loadedList) {
        int splitAt = entry.lastIndexOf(",");
        if (splitAt > 0 && entry.length() > splitAt+1) {
            String id = entry.substring(0, splitAt);
            Color color = HtmlColors.decode(entry.substring(splitAt + 1));
            loadedData.add(new MsgColorItem(id, color));
        }
    }
    data = loadedData;
}
 
开发者ID:chatty,项目名称:chatty,代码行数:23,代码来源:MsgColorManager.java

示例14: saveToSettings

import chatty.gui.HtmlColors; //导入依赖的package包/类
/**
 * Copy the current data to the settings.
 */
private void saveToSettings() {
    List<String> dataToSave = new LinkedList<>();
    for (MsgColorItem item : data) {
        dataToSave.add(item.getId()+","+HtmlColors.getColorString(item.getColor()));
    }
    settings.putList(DATA_SETTING, dataToSave);
}
 
开发者ID:chatty,项目名称:chatty,代码行数:11,代码来源:MsgColorManager.java

示例15: UsercolorItem

import chatty.gui.HtmlColors; //导入依赖的package包/类
public UsercolorItem(String id, Color color) {
    this.color = color;
    this.id = id;
    
    // Check if a color was specified as id
    if (id.startsWith("#")) {
        idColor = HtmlColors.decode(id, null);
    } else {
        if (id.startsWith("$color:") && id.length() > 7) {
            idColor = HtmlColors.decode(id.substring(7), null);
        } else {
            idColor = null;
        }
    }

    // Check if a category was specified as id
    if (id.startsWith("$cat:") && id.length() > 5) {
        category = id.substring(5);
    } else {
        category = null;
    }
    
    // Save the type
    if (idColor != null) {
        type = TYPE_COLOR;
    } else if (id.startsWith("$cat:") && id.length() > 5) {
        type = TYPE_CATEGORY;
    } else if (statusDef.contains(id)) {
        type = TYPE_STATUS;
    } else if (Helper.validateChannel(id)) {
        type = TYPE_NAME;
    } else if (id.equals("$all")) {
        type = TYPE_ALL;
    } else {
        type = TYPE_UNDEFINED;
    }
}
 
开发者ID:chatty,项目名称:chatty,代码行数:38,代码来源:UsercolorItem.java


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