001: /*
002: * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: package java.awt;
027:
028: import java.io.*;
029:
030: /**
031: * The <code>GraphicsConfigTemplate</code> class is used to obtain a valid
032: * {@link GraphicsConfiguration}. A user instantiates one of these
033: * objects and then sets all non-default attributes as desired. The
034: * {@link GraphicsDevice#getBestConfiguration} method found in the
035: * {@link GraphicsDevice} class is then called with this
036: * <code>GraphicsConfigTemplate</code>. A valid
037: * <code>GraphicsConfiguration</code> is returned that meets or exceeds
038: * what was requested in the <code>GraphicsConfigTemplate</code>.
039: * @see GraphicsDevice
040: * @see GraphicsConfiguration
041: *
042: * @version 1.26, 06/05/07
043: * @since 1.2
044: */
045: public abstract class GraphicsConfigTemplate implements Serializable {
046: /*
047: * serialVersionUID
048: */
049: private static final long serialVersionUID = -8061369279557787079L;
050:
051: /**
052: * This class is an abstract class so only subclasses can be
053: * instantiated.
054: */
055: public GraphicsConfigTemplate() {
056: }
057:
058: /**
059: * Value used for "Enum" (Integer) type. States that this
060: * feature is required for the <code>GraphicsConfiguration</code>
061: * object. If this feature is not available, do not select the
062: * <code>GraphicsConfiguration</code> object.
063: */
064: public static final int REQUIRED = 1;
065:
066: /**
067: * Value used for "Enum" (Integer) type. States that this
068: * feature is desired for the <code>GraphicsConfiguration</code>
069: * object. A selection with this feature is preferred over a
070: * selection that does not include this feature, although both
071: * selections can be considered valid matches.
072: */
073: public static final int PREFERRED = 2;
074:
075: /**
076: * Value used for "Enum" (Integer) type. States that this
077: * feature is not necessary for the selection of the
078: * <code>GraphicsConfiguration</code> object. A selection
079: * without this feature is preferred over a selection that
080: * includes this feature since it is not used.
081: */
082: public static final int UNNECESSARY = 3;
083:
084: /**
085: * Returns the "best" configuration possible that passes the
086: * criteria defined in the <code>GraphicsConfigTemplate</code>.
087: * @param gc the array of <code>GraphicsConfiguration</code>
088: * objects to choose from.
089: * @return a <code>GraphicsConfiguration</code> object that is
090: * the best configuration possible.
091: * @see GraphicsConfiguration
092: */
093: public abstract GraphicsConfiguration getBestConfiguration(
094: GraphicsConfiguration[] gc);
095:
096: /**
097: * Returns a <code>boolean</code> indicating whether or
098: * not the specified <code>GraphicsConfiguration</code> can be
099: * used to create a drawing surface that supports the indicated
100: * features.
101: * @param gc the <code>GraphicsConfiguration</code> object to test
102: * @return <code>true</code> if this
103: * <code>GraphicsConfiguration</code> object can be used to create
104: * surfaces that support the indicated features;
105: * <code>false</code> if the <code>GraphicsConfiguration</code> can
106: * not be used to create a drawing surface usable by this Java(tm)
107: * API.
108: */
109: public abstract boolean isGraphicsConfigSupported(
110: GraphicsConfiguration gc);
111:
112: }
|