當前位置: 首頁>>代碼示例>>Java>>正文


Java Color.toString方法代碼示例

本文整理匯總了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());
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:37,代碼來源:Test7022041.java

示例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;
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:8,代碼來源:bug8057791.java

示例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;
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:9,代碼來源:bug8057791.java

示例4: getTextColor

import java.awt.Color; //導入方法依賴的package包/類
/**
    * Returns the text Color of the activator text
    */
   public String getTextColor() {
Color color = getForeground();
return color.toString();
   }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:BrowserDisplayer.java


注:本文中的java.awt.Color.toString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。