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