< prev index next >
src/java.desktop/share/classes/java/awt/GraphicsDevice.java
Print this page
*** 31,53 ****
import sun.awt.AWTAccessor;
import sun.awt.AppContext;
import sun.awt.SunToolkit;
/**
! * The <code>GraphicsDevice</code> class describes the graphics devices
* that might be available in a particular graphics environment. These
* include screen and printer devices. Note that there can be many screens
* and many printers in an instance of {@link GraphicsEnvironment}. Each
* graphics device has one or more {@link GraphicsConfiguration} objects
* associated with it. These objects specify the different configurations
! * in which the <code>GraphicsDevice</code> can be used.
* <p>
! * In a multi-screen environment, the <code>GraphicsConfiguration</code>
* objects can be used to render components on multiple screens. The
! * following code sample demonstrates how to create a <code>JFrame</code>
! * object for each <code>GraphicsConfiguration</code> on each screen
! * device in the <code>GraphicsEnvironment</code>:
* <pre>{@code
* GraphicsEnvironment ge = GraphicsEnvironment.
* getLocalGraphicsEnvironment();
* GraphicsDevice[] gs = ge.getScreenDevices();
* for (int j = 0; j < gs.length; j++) {
--- 31,53 ----
import sun.awt.AWTAccessor;
import sun.awt.AppContext;
import sun.awt.SunToolkit;
/**
! * The {@code GraphicsDevice} class describes the graphics devices
* that might be available in a particular graphics environment. These
* include screen and printer devices. Note that there can be many screens
* and many printers in an instance of {@link GraphicsEnvironment}. Each
* graphics device has one or more {@link GraphicsConfiguration} objects
* associated with it. These objects specify the different configurations
! * in which the {@code GraphicsDevice} can be used.
* <p>
! * In a multi-screen environment, the {@code GraphicsConfiguration}
* objects can be used to render components on multiple screens. The
! * following code sample demonstrates how to create a {@code JFrame}
! * object for each {@code GraphicsConfiguration} on each screen
! * device in the {@code GraphicsEnvironment}:
* <pre>{@code
* GraphicsEnvironment ge = GraphicsEnvironment.
* getLocalGraphicsEnvironment();
* GraphicsDevice[] gs = ge.getScreenDevices();
* for (int j = 0; j < gs.length; j++) {
*** 140,221 ****
*/
PERPIXEL_TRANSLUCENT;
}
/**
! * Returns the type of this <code>GraphicsDevice</code>.
! * @return the type of this <code>GraphicsDevice</code>, which can
* either be TYPE_RASTER_SCREEN, TYPE_PRINTER or TYPE_IMAGE_BUFFER.
* @see #TYPE_RASTER_SCREEN
* @see #TYPE_PRINTER
* @see #TYPE_IMAGE_BUFFER
*/
public abstract int getType();
/**
* Returns the identification string associated with this
! * <code>GraphicsDevice</code>.
* <p>
* A particular program might use more than one
! * <code>GraphicsDevice</code> in a <code>GraphicsEnvironment</code>.
! * This method returns a <code>String</code> identifying a
! * particular <code>GraphicsDevice</code> in the local
! * <code>GraphicsEnvironment</code>. Although there is
! * no public method to set this <code>String</code>, a programmer can
! * use the <code>String</code> for debugging purposes. Vendors of
* the Java™ Runtime Environment can
! * format the return value of the <code>String</code>. To determine
! * how to interpret the value of the <code>String</code>, contact the
* vendor of your Java Runtime. To find out who the vendor is, from
* your program, call the
* {@link System#getProperty(String) getProperty} method of the
* System class with "java.vendor".
! * @return a <code>String</code> that is the identification
! * of this <code>GraphicsDevice</code>.
*/
public abstract String getIDstring();
/**
! * Returns all of the <code>GraphicsConfiguration</code>
! * objects associated with this <code>GraphicsDevice</code>.
! * @return an array of <code>GraphicsConfiguration</code>
* objects that are associated with this
! * <code>GraphicsDevice</code>.
*/
public abstract GraphicsConfiguration[] getConfigurations();
/**
! * Returns the default <code>GraphicsConfiguration</code>
! * associated with this <code>GraphicsDevice</code>.
! * @return the default <code>GraphicsConfiguration</code>
! * of this <code>GraphicsDevice</code>.
*/
public abstract GraphicsConfiguration getDefaultConfiguration();
/**
* Returns the "best" configuration possible that passes the
* criteria defined in the {@link GraphicsConfigTemplate}.
! * @param gct the <code>GraphicsConfigTemplate</code> object
! * used to obtain a valid <code>GraphicsConfiguration</code>
! * @return a <code>GraphicsConfiguration</code> that passes
* the criteria defined in the specified
! * <code>GraphicsConfigTemplate</code>.
* @see GraphicsConfigTemplate
*/
public GraphicsConfiguration
getBestConfiguration(GraphicsConfigTemplate gct) {
GraphicsConfiguration[] configs = getConfigurations();
return gct.getBestConfiguration(configs);
}
/**
! * Returns <code>true</code> if this <code>GraphicsDevice</code>
* supports full-screen exclusive mode.
* If a SecurityManager is installed, its
! * <code>checkPermission</code> method will be called
! * with <code>AWTPermission("fullScreenExclusive")</code>.
! * <code>isFullScreenSupported</code> returns true only if
* that permission is granted.
* @return whether full-screen exclusive mode is available for
* this graphics device
* @see java.awt.AWTPermission
* @since 1.4
--- 140,221 ----
*/
PERPIXEL_TRANSLUCENT;
}
/**
! * Returns the type of this {@code GraphicsDevice}.
! * @return the type of this {@code GraphicsDevice}, which can
* either be TYPE_RASTER_SCREEN, TYPE_PRINTER or TYPE_IMAGE_BUFFER.
* @see #TYPE_RASTER_SCREEN
* @see #TYPE_PRINTER
* @see #TYPE_IMAGE_BUFFER
*/
public abstract int getType();
/**
* Returns the identification string associated with this
! * {@code GraphicsDevice}.
* <p>
* A particular program might use more than one
! * {@code GraphicsDevice} in a {@code GraphicsEnvironment}.
! * This method returns a {@code String} identifying a
! * particular {@code GraphicsDevice} in the local
! * {@code GraphicsEnvironment}. Although there is
! * no public method to set this {@code String}, a programmer can
! * use the {@code String} for debugging purposes. Vendors of
* the Java™ Runtime Environment can
! * format the return value of the {@code String}. To determine
! * how to interpret the value of the {@code String}, contact the
* vendor of your Java Runtime. To find out who the vendor is, from
* your program, call the
* {@link System#getProperty(String) getProperty} method of the
* System class with "java.vendor".
! * @return a {@code String} that is the identification
! * of this {@code GraphicsDevice}.
*/
public abstract String getIDstring();
/**
! * Returns all of the {@code GraphicsConfiguration}
! * objects associated with this {@code GraphicsDevice}.
! * @return an array of {@code GraphicsConfiguration}
* objects that are associated with this
! * {@code GraphicsDevice}.
*/
public abstract GraphicsConfiguration[] getConfigurations();
/**
! * Returns the default {@code GraphicsConfiguration}
! * associated with this {@code GraphicsDevice}.
! * @return the default {@code GraphicsConfiguration}
! * of this {@code GraphicsDevice}.
*/
public abstract GraphicsConfiguration getDefaultConfiguration();
/**
* Returns the "best" configuration possible that passes the
* criteria defined in the {@link GraphicsConfigTemplate}.
! * @param gct the {@code GraphicsConfigTemplate} object
! * used to obtain a valid {@code GraphicsConfiguration}
! * @return a {@code GraphicsConfiguration} that passes
* the criteria defined in the specified
! * {@code GraphicsConfigTemplate}.
* @see GraphicsConfigTemplate
*/
public GraphicsConfiguration
getBestConfiguration(GraphicsConfigTemplate gct) {
GraphicsConfiguration[] configs = getConfigurations();
return gct.getBestConfiguration(configs);
}
/**
! * Returns {@code true} if this {@code GraphicsDevice}
* supports full-screen exclusive mode.
* If a SecurityManager is installed, its
! * {@code checkPermission} method will be called
! * with {@code AWTPermission("fullScreenExclusive")}.
! * {@code isFullScreenSupported} returns true only if
* that permission is granted.
* @return whether full-screen exclusive mode is available for
* this graphics device
* @see java.awt.AWTPermission
* @since 1.4
*** 225,247 ****
}
/**
* Enter full-screen mode, or return to windowed mode. The entered
* full-screen mode may be either exclusive or simulated. Exclusive
! * mode is only available if <code>isFullScreenSupported</code>
! * returns <code>true</code>.
* <p>
* Exclusive mode implies:
* <ul>
* <li>Windows cannot overlap the full-screen window. All other application
* windows will always appear beneath the full-screen window in the Z-order.
* <li>There can be only one full-screen window on a device at any time,
* so calling this method while there is an existing full-screen Window
* will cause the existing full-screen window to
* return to windowed mode.
* <li>Input method windows are disabled. It is advisable to call
! * <code>Component.enableInputMethods(false)</code> to make a component
* a non-client of the input method framework.
* </ul>
* <p>
* The simulated full-screen mode places and resizes the window to the maximum
* possible visible area of the screen. However, the native windowing system
--- 225,247 ----
}
/**
* Enter full-screen mode, or return to windowed mode. The entered
* full-screen mode may be either exclusive or simulated. Exclusive
! * mode is only available if {@code isFullScreenSupported}
! * returns {@code true}.
* <p>
* Exclusive mode implies:
* <ul>
* <li>Windows cannot overlap the full-screen window. All other application
* windows will always appear beneath the full-screen window in the Z-order.
* <li>There can be only one full-screen window on a device at any time,
* so calling this method while there is an existing full-screen Window
* will cause the existing full-screen window to
* return to windowed mode.
* <li>Input method windows are disabled. It is advisable to call
! * {@code Component.enableInputMethods(false)} to make a component
* a non-client of the input method framework.
* </ul>
* <p>
* The simulated full-screen mode places and resizes the window to the maximum
* possible visible area of the screen. However, the native windowing system
*** 339,352 ****
fullScreenWindow.toFront();
}
}
/**
! * Returns the <code>Window</code> object representing the
* full-screen window if the device is in full-screen mode.
*
! * @return the full-screen window, or <code>null</code> if the device is
* not in full-screen mode.
* @see #setFullScreenWindow(Window)
* @since 1.4
*/
public Window getFullScreenWindow() {
--- 339,352 ----
fullScreenWindow.toFront();
}
}
/**
! * Returns the {@code Window} object representing the
* full-screen window if the device is in full-screen mode.
*
! * @return the full-screen window, or {@code null} if the device is
* not in full-screen mode.
* @see #setFullScreenWindow(Window)
* @since 1.4
*/
public Window getFullScreenWindow() {
*** 360,370 ****
}
return returnWindow;
}
/**
! * Returns <code>true</code> if this <code>GraphicsDevice</code>
* supports low-level display changes.
* On some platforms low-level display changes may only be allowed in
* full-screen exclusive mode (i.e., if {@link #isFullScreenSupported()}
* returns {@code true} and the application has already entered
* full-screen mode using {@link #setFullScreenWindow}).
--- 360,370 ----
}
return returnWindow;
}
/**
! * Returns {@code true} if this {@code GraphicsDevice}
* supports low-level display changes.
* On some platforms low-level display changes may only be allowed in
* full-screen exclusive mode (i.e., if {@link #isFullScreenSupported()}
* returns {@code true} and the application has already entered
* full-screen mode using {@link #setFullScreenWindow}).
*** 418,432 ****
* gd.setDisplayMode(newDisplayMode);
* }
* </code></pre>
*
* @param dm The new display mode of this graphics device.
! * @exception IllegalArgumentException if the <code>DisplayMode</code>
! * supplied is <code>null</code>, or is not available in the array returned
! * by <code>getDisplayModes</code>
* @exception UnsupportedOperationException if
! * <code>isDisplayChangeSupported</code> returns <code>false</code>
* @see #getDisplayMode
* @see #getDisplayModes
* @see #isDisplayChangeSupported
* @since 1.4
*/
--- 418,432 ----
* gd.setDisplayMode(newDisplayMode);
* }
* </code></pre>
*
* @param dm The new display mode of this graphics device.
! * @exception IllegalArgumentException if the {@code DisplayMode}
! * supplied is {@code null}, or is not available in the array returned
! * by {@code getDisplayModes}
* @exception UnsupportedOperationException if
! * {@code isDisplayChangeSupported} returns {@code false}
* @see #getDisplayMode
* @see #getDisplayModes
* @see #isDisplayChangeSupported
* @since 1.4
*/
*** 434,444 ****
throw new UnsupportedOperationException("Cannot change display mode");
}
/**
* Returns the current display mode of this
! * <code>GraphicsDevice</code>.
* The returned display mode is allowed to have a refresh rate
* {@link DisplayMode#REFRESH_RATE_UNKNOWN} if it is indeterminate.
* Likewise, the returned display mode is allowed to have a bit depth
* {@link DisplayMode#BIT_DEPTH_MULTI} if it is indeterminate or if multiple
* bit depths are supported.
--- 434,444 ----
throw new UnsupportedOperationException("Cannot change display mode");
}
/**
* Returns the current display mode of this
! * {@code GraphicsDevice}.
* The returned display mode is allowed to have a refresh rate
* {@link DisplayMode#REFRESH_RATE_UNKNOWN} if it is indeterminate.
* Likewise, the returned display mode is allowed to have a bit depth
* {@link DisplayMode#BIT_DEPTH_MULTI} if it is indeterminate or if multiple
* bit depths are supported.
*** 453,463 ****
return new DisplayMode(r.width, r.height, cm.getPixelSize(), 0);
}
/**
* Returns all display modes available for this
! * <code>GraphicsDevice</code>.
* The returned display modes are allowed to have a refresh rate
* {@link DisplayMode#REFRESH_RATE_UNKNOWN} if it is indeterminate.
* Likewise, the returned display modes are allowed to have a bit depth
* {@link DisplayMode#BIT_DEPTH_MULTI} if it is indeterminate or if multiple
* bit depths are supported.
--- 453,463 ----
return new DisplayMode(r.width, r.height, cm.getPixelSize(), 0);
}
/**
* Returns all display modes available for this
! * {@code GraphicsDevice}.
* The returned display modes are allowed to have a refresh rate
* {@link DisplayMode#REFRESH_RATE_UNKNOWN} if it is indeterminate.
* Likewise, the returned display modes are allowed to have a bit depth
* {@link DisplayMode#BIT_DEPTH_MULTI} if it is indeterminate or if multiple
* bit depths are supported.
< prev index next >