1. /*
  2. * @(#)GraphicsDevice.java 1.16 01/11/29
  3. *
  4. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.awt;
  8. /**
  9. * The <code>GraphicsDevice</code> class describes the graphics devices
  10. * that might be available in a particular graphics environment. These
  11. * include screen and printer devices. Note that there can be many screens
  12. * and many printers in an instance of {@link GraphicsEnvironment}. Each
  13. * graphics device has one or more {@link GraphicsConfiguration} objects
  14. * associated with it. These objects specify the different configurations
  15. * in which the <code>GraphicsDevice</code> can be used.
  16. * @see GraphicsEnvironment
  17. * @see GraphicsConfiguration
  18. * @version 10 Feb 1997
  19. */
  20. public abstract class GraphicsDevice {
  21. /**
  22. * This is an abstract class that cannot be instantiated directly.
  23. * Instances must be obtained from a suitable factory or query method.
  24. * @see GraphicsEnvironment#getScreenDevices
  25. * @see GraphicsEnvironment#getDefaultScreenDevice
  26. * @see GraphicsConfiguration#getDevice
  27. */
  28. protected GraphicsDevice() {
  29. }
  30. /**
  31. * Device is a raster screen.
  32. */
  33. public final static int TYPE_RASTER_SCREEN = 0;
  34. /**
  35. * Device is a printer.
  36. */
  37. public final static int TYPE_PRINTER = 1;
  38. /**
  39. * Device is an image buffer. This buffer can reside in device
  40. * or system memory but it is not physically viewable by the user.
  41. */
  42. public final static int TYPE_IMAGE_BUFFER = 2;
  43. /**
  44. * Returns the type of this <code>GraphicsDevice</code>.
  45. * @return the type of this <code>GraphicsDevice</code>, which can
  46. * either be TYPE_RASTER_SCREEN, TYPE_PRINTER or TYPE_IMAGE_BUFFER.
  47. * @see #TYPE_RASTER_SCREEN
  48. * @see #TYPE_PRINTER
  49. * @see #TYPE_IMAGE_BUFFER
  50. */
  51. public abstract int getType();
  52. /**
  53. * Returns the identification string associated with this
  54. * <code>GraphicsDevice</code>.
  55. * @return a <code>String</code> that is the identification
  56. * of this <code>GraphicsDevice</code>.
  57. */
  58. public abstract String getIDstring();
  59. /**
  60. * Returns all of the <code>GraphicsConfiguration</code>
  61. * objects associated with this <code>GraphicsDevice</code>.
  62. * @return an array of <code>GraphicsConfiguration</code>
  63. * objects that are associated with this
  64. * <code>GraphicsDevice</code>.
  65. */
  66. public abstract GraphicsConfiguration[] getConfigurations();
  67. /**
  68. * Returns the default <code>GraphicsConfiguration</code>
  69. * associated with this <code>GraphicsDevice</code>.
  70. * @return the default <code>GraphicsConfiguration</code>
  71. * of this <code>GraphicsDevice</code>.
  72. */
  73. public abstract GraphicsConfiguration getDefaultConfiguration();
  74. /**
  75. * Returns the "best" configuration possible that passes the
  76. * criteria defined in the {@link GraphicsConfigTemplate}.
  77. * @param gct the <code>GraphicsConfigTemplate</code> object
  78. * used to obtain a valid <code>GraphicsConfiguration</code>
  79. * @return a <code>GraphicsConfiguration</code> that passes
  80. * the criteria defined in the specified
  81. * <code>GraphicsConfigTemplate</code>.
  82. * @see GraphicsConfigTemplate
  83. */
  84. public GraphicsConfiguration
  85. getBestConfiguration(GraphicsConfigTemplate gct) {
  86. GraphicsConfiguration[] configs = getConfigurations();
  87. return gct.getBestConfiguration(configs);
  88. }
  89. }