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. package java.awt;
  8. import java.awt.Component;
  9. import java.io.*;
  10. /**
  11. * The <code>GraphicsConfigTemplate</code> class is used to obtain a valid
  12. * {@link GraphicsConfiguration}. A user instantiates one of these
  13. * objects and then sets all non-default attributes as desired. The
  14. * {@link GraphicsDevice#getBestConfiguration} method found in the
  15. * {@link GraphicsDevice} class is then called with this
  16. * <code>GraphicsConfigTemplate</code>. A valid
  17. * <code>GraphicsConfiguration</code> is returned that meets or exceeds
  18. * what was requested in the <code>GraphicsConfigTemplate</code>.
  19. * @see GraphicsDevice
  20. * @see GraphicsConfiguration
  21. *
  22. * @version 1.16, 12/19/03
  23. * @since 1.2
  24. */
  25. public abstract class GraphicsConfigTemplate implements Serializable {
  26. /**
  27. * This class is an abstract class so only subclasses can be
  28. * instantiated.
  29. */
  30. public GraphicsConfigTemplate() {
  31. }
  32. /**
  33. * Value used for "Enum" (Integer) type. States that this
  34. * feature is required for the <code>GraphicsConfiguration</code>
  35. * object. If this feature is not available, do not select the
  36. * <code>GraphicsConfiguration</code> object.
  37. */
  38. public static final int REQUIRED = 1;
  39. /**
  40. * Value used for "Enum" (Integer) type. States that this
  41. * feature is desired for the <code>GraphicsConfiguration</code>
  42. * object. A selection with this feature is preferred over a
  43. * selection that does not include this feature, although both
  44. * selections can be considered valid matches.
  45. */
  46. public static final int PREFERRED = 2;
  47. /**
  48. * Value used for "Enum" (Integer) type. States that this
  49. * feature is not necessary for the selection of the
  50. * <code>GraphicsConfiguration</code> object. A selection
  51. * without this feature is preferred over a selection that
  52. * includes this feature since it is not used.
  53. */
  54. public static final int UNNECESSARY = 3;
  55. /**
  56. * Returns the "best" configuration possible that passes the
  57. * criteria defined in the <code>GraphicsConfigTemplate</code>.
  58. * @param gc the array of <code>GraphicsConfiguration</code>
  59. * objects to choose from.
  60. * @return a <code>GraphicsConfiguration</code> object that is
  61. * the best configuration possible.
  62. * @see GraphicsConfiguration
  63. */
  64. public abstract GraphicsConfiguration
  65. getBestConfiguration(GraphicsConfiguration[] gc);
  66. /**
  67. * Returns a <code>boolean</code> indicating whether or
  68. * not the specified <code>GraphicsConfiguration</code> can be
  69. * used to create a drawing surface that supports the indicated
  70. * features.
  71. * @param gc the <code>GraphicsConfiguration</code> object to test
  72. * @return <code>true</code> if this
  73. * <code>GraphicsConfiguration</code> object can be used to create
  74. * surfaces that support the indicated features;
  75. * <code>false</code> if the <code>GraphicsConfiguration</code> can
  76. * not be used to create a drawing surface usable by this Java(tm)
  77. * API.
  78. */
  79. public abstract boolean
  80. isGraphicsConfigSupported(GraphicsConfiguration gc);
  81. }