本文整理匯總了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();
}