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