本文整理汇总了Java中java.awt.Color.toString方法的典型用法代码示例。如果您正苦于以下问题:Java Color.toString方法的具体用法?Java Color.toString怎么用?Java Color.toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Color
的用法示例。
在下文中一共展示了Color.toString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkTitleColor
import java.awt.Color; //导入方法依赖的package包/类
/**
* Check behaviour of method TitledBorder.getTitleColor()
*/
private static void checkTitleColor() {
TitledBorder titledBorder = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
Color defaultColor = UIManager.getLookAndFeelDefaults().getColor("TitledBorder.titleColor");
Color titledBorderColor = titledBorder.getTitleColor();
// check default configuration
if (defaultColor == null) {
if (titledBorderColor == null) {
return;
}
else {
throw new RuntimeException("TitledBorder default color should be null");
}
}
if (!defaultColor.equals(titledBorderColor)) {
throw new RuntimeException("L&F default color " + defaultColor.toString()
+ " differs from TitledBorder color " + titledBorderColor.toString());
}
// title color is explicitly specified
Color color = Color.green;
titledBorder.setTitleColor(color);
if (!color.equals(titledBorder.getTitleColor())) {
throw new RuntimeException("TitledBorder color should be " + color.toString());
}
// title color is unspecified
titledBorder.setTitleColor(null);
if (!defaultColor.equals(titledBorder.getTitleColor())) {
throw new RuntimeException("L&F default color " + defaultColor.toString()
+ " differs from TitledBorder color " + titledBorderColor.toString());
}
}
示例2: checkColor
import java.awt.Color; //导入方法依赖的package包/类
private static void checkColor(Color colorCheck, Rectangle bounds) {
if (!findColor(colorCheck, bounds)) {
String error = "[ERROR][" + colorCheck.toString()
+ "] Not found in selected cell";
errorString += error;
}
}
示例3: checkNotColor
import java.awt.Color; //导入方法依赖的package包/类
private static void checkNotColor(Color colorCheck, Rectangle bounds) {
if (findColor(colorCheck, bounds)) {
String error = "[ERROR][" + colorCheck.toString()
+ "] is found in selected cell. "
+ "Not supposed to be found in negative test case";
errorString += error;
}
}
示例4: getTextColor
import java.awt.Color; //导入方法依赖的package包/类
/**
* Returns the text Color of the activator text
*/
public String getTextColor() {
Color color = getForeground();
return color.toString();
}