本文整理匯總了Java中java.awt.image.ColorModel.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java ColorModel.equals方法的具體用法?Java ColorModel.equals怎麽用?Java ColorModel.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.image.ColorModel
的用法示例。
在下文中一共展示了ColorModel.equals方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testHeadful
import java.awt.image.ColorModel; //導入方法依賴的package包/類
private static void testHeadful() {
GraphicsEnvironment ge
= GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsConfiguration gc
= ge.getDefaultScreenDevice().getDefaultConfiguration();
Dimension gcSize = gc.getBounds().getSize();
ColorModel gcCM = gc.getColorModel();
Dimension toolkitSize = Toolkit.getDefaultToolkit().getScreenSize();
ColorModel toolkitCM = Toolkit.getDefaultToolkit().getColorModel();
if (!gcSize.equals(toolkitSize)) {
System.err.println("Toolkit size = " + toolkitSize);
System.err.println("GraphicsConfiguration size = " + gcSize);
throw new RuntimeException("Incorrect size");
}
if (!gcCM.equals(toolkitCM)) {
System.err.println("Toolkit color model = " + toolkitCM);
System.err.println("GraphicsConfiguration color model = " + gcCM);
throw new RuntimeException("Incorrect color model");
}
}
示例2: main
import java.awt.image.ColorModel; //導入方法依賴的package包/類
public static void main(String[] args) {
SimpleColorModel scm1 = new SimpleColorModel(3);
SimpleColorModel scm2 = new SimpleColorModel(3);
SimpleColorModel scm3 = new SimpleColorModel(8);
ColorModel rgbcm = ColorModel.getRGBdefault();
try {
if (scm1.equals(scm2)) {
throw new RuntimeException("Test 1 failed: " +
"scm1 should not equal scm2");
}
if (scm1.equals(scm3)) {
throw new RuntimeException("Test 2 failed: " +
"scm1 should not equal scm3");
}
if (scm1.equals(rgbcm) || rgbcm.equals(scm1)) {
throw new RuntimeException("Test 3 failed: " +
"scm1 should not equal rgbcm");
}
} catch (Exception e) {
throw new RuntimeException("Test failed: " + e);
}
}