本文整理汇总了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);
}
示例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;
}
示例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());
}
}
});
}
示例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;
}
示例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);
}