jdk/src/share/classes/java/awt/GraphicsConfigTemplate.java
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.awt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * The <code>GraphicsConfigTemplate</code> class is used to obtain a valid
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * {@link GraphicsConfiguration}.  A user instantiates one of these
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * objects and then sets all non-default attributes as desired.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * {@link GraphicsDevice#getBestConfiguration} method found in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * {@link GraphicsDevice} class is then called with this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * <code>GraphicsConfigTemplate</code>.  A valid
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * <code>GraphicsConfiguration</code> is returned that meets or exceeds
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * what was requested in the <code>GraphicsConfigTemplate</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * @see GraphicsDevice
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * @see GraphicsConfiguration
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * @since       1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
public abstract class GraphicsConfigTemplate implements Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
     * serialVersionUID
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    private static final long serialVersionUID = -8061369279557787079L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
     * This class is an abstract class so only subclasses can be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     * instantiated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    public GraphicsConfigTemplate() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * Value used for "Enum" (Integer) type.  States that this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * feature is required for the <code>GraphicsConfiguration</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * object.  If this feature is not available, do not select the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * <code>GraphicsConfiguration</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    public static final int REQUIRED    = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * Value used for "Enum" (Integer) type.  States that this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * feature is desired for the <code>GraphicsConfiguration</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * object.  A selection with this feature is preferred over a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * selection that does not include this feature, although both
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * selections can be considered valid matches.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    public static final int PREFERRED   = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * Value used for "Enum" (Integer) type.  States that this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * feature is not necessary for the selection of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * <code>GraphicsConfiguration</code> object.  A selection
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * without this feature is preferred over a selection that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * includes this feature since it is not used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    public static final int UNNECESSARY = 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * Returns the "best" configuration possible that passes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * criteria defined in the <code>GraphicsConfigTemplate</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * @param gc the array of <code>GraphicsConfiguration</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * objects to choose from.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * @return a <code>GraphicsConfiguration</code> object that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * the best configuration possible.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * @see GraphicsConfiguration
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    public abstract GraphicsConfiguration
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
      getBestConfiguration(GraphicsConfiguration[] gc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * Returns a <code>boolean</code> indicating whether or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * not the specified <code>GraphicsConfiguration</code> can be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * used to create a drawing surface that supports the indicated
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * features.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * @param gc the <code>GraphicsConfiguration</code> object to test
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * @return <code>true</code> if this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * <code>GraphicsConfiguration</code> object can be used to create
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * surfaces that support the indicated features;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * <code>false</code> if the <code>GraphicsConfiguration</code> can
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * not be used to create a drawing surface usable by this Java(tm)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * API.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    public abstract boolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
      isGraphicsConfigSupported(GraphicsConfiguration gc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
}