KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > awt > GraphicsConfigTemplate


1 /*
2  * @(#)GraphicsConfigTemplate.java 1.16 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.awt;
9
10 import java.awt.Component JavaDoc;
11 import java.io.*;
12
13 /**
14  * The <code>GraphicsConfigTemplate</code> class is used to obtain a valid
15  * {@link GraphicsConfiguration}. A user instantiates one of these
16  * objects and then sets all non-default attributes as desired. The
17  * {@link GraphicsDevice#getBestConfiguration} method found in the
18  * {@link GraphicsDevice} class is then called with this
19  * <code>GraphicsConfigTemplate</code>. A valid
20  * <code>GraphicsConfiguration</code> is returned that meets or exceeds
21  * what was requested in the <code>GraphicsConfigTemplate</code>.
22  * @see GraphicsDevice
23  * @see GraphicsConfiguration
24  *
25  * @version 1.16, 12/19/03
26  * @since 1.2
27  */

28 public abstract class GraphicsConfigTemplate implements Serializable {
29
30     /**
31      * This class is an abstract class so only subclasses can be
32      * instantiated.
33      */

34     public GraphicsConfigTemplate() {
35     }
36
37     /**
38      * Value used for "Enum" (Integer) type. States that this
39      * feature is required for the <code>GraphicsConfiguration</code>
40      * object. If this feature is not available, do not select the
41      * <code>GraphicsConfiguration</code> object.
42      */

43     public static final int REQUIRED = 1;
44
45     /**
46      * Value used for "Enum" (Integer) type. States that this
47      * feature is desired for the <code>GraphicsConfiguration</code>
48      * object. A selection with this feature is preferred over a
49      * selection that does not include this feature, although both
50      * selections can be considered valid matches.
51      */

52     public static final int PREFERRED = 2;
53
54     /**
55      * Value used for "Enum" (Integer) type. States that this
56      * feature is not necessary for the selection of the
57      * <code>GraphicsConfiguration</code> object. A selection
58      * without this feature is preferred over a selection that
59      * includes this feature since it is not used.
60      */

61     public static final int UNNECESSARY = 3;
62
63     /**
64      * Returns the "best" configuration possible that passes the
65      * criteria defined in the <code>GraphicsConfigTemplate</code>.
66      * @param gc the array of <code>GraphicsConfiguration</code>
67      * objects to choose from.
68      * @return a <code>GraphicsConfiguration</code> object that is
69      * the best configuration possible.
70      * @see GraphicsConfiguration
71      */

72     public abstract GraphicsConfiguration JavaDoc
73       getBestConfiguration(GraphicsConfiguration JavaDoc[] gc);
74
75     /**
76      * Returns a <code>boolean</code> indicating whether or
77      * not the specified <code>GraphicsConfiguration</code> can be
78      * used to create a drawing surface that supports the indicated
79      * features.
80      * @param gc the <code>GraphicsConfiguration</code> object to test
81      * @return <code>true</code> if this
82      * <code>GraphicsConfiguration</code> object can be used to create
83      * surfaces that support the indicated features;
84      * <code>false</code> if the <code>GraphicsConfiguration</code> can
85      * not be used to create a drawing surface usable by this Java(tm)
86      * API.
87      */

88     public abstract boolean
89       isGraphicsConfigSupported(GraphicsConfiguration JavaDoc gc);
90
91 }
92
93
Popular Tags