Your preferences have been saved!
» extends JComponent to exercise Graphics - import java.awt.EventQueue; import java.awt.Graphics; import javax.swing.JComponent; import javax.swing.JFrame; /**  * @version 1.32 2007-06-12  * @author Cay Horstmann  */ public class NotHelloWorld {... 06 Feb 12 » Get the GraphicsEnvironment and GraphicsDevice - import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; public class ShowConfigurations {   public static void main(String[] args) {     GraphicsEnvironment ge = GraphicsEnvironment         .getLocalGraphicsEnvironment();     GraphicsDevice defaultScreen = ge.getDefaultScreenDevice();     GraphicsConfiguration[] configurations = defaultScreen         .getConfigurations();... 06 Feb 12 » Getting the Number of Screens - import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.HeadlessException; public class Main {   public static void main(String[] argv) throws Exception {     GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();     try {       GraphicsDevice[] gs = ge.getScreenDevices();       int numScreens = gs.length;     } catch (HeadlessException e) {... 06 Feb 12 » If more than one screen is available, gets the size - import java.awt.DisplayMode; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; public class Main {   public static void main(String[] argv) throws Exception {     GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();     GraphicsDevice[] gs = ge.getScreenDevices();     for (int i = 0; i < gs.length; i++) {       DisplayMode dm = gs[i].getDisplayMode();       int screenWidth = dm.getWidth();... 06 Feb 12 » Setting the Screen Size, Refresh Rate, or Number of Colors - import java.awt.DisplayMode; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; public class Main {   public static void main(String[] argv) throws Exception {     GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();     GraphicsDevice gs = ge.getDefaultScreenDevice();     boolean canChg = gs.isDisplayChangeSupported();     if (canChg) {       DisplayMode displayMode = gs.getDisplayMode();... 06 Feb 12 » Create an image that supports arbitrary levels of transparency from - import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.Transparency; import java.awt.image.BufferedImage; public class Main {   public static void main(String[] argv) throws Exception {     GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();     GraphicsDevice gs = ge.getDefaultScreenDevice();     GraphicsConfiguration gc = gs.getDefaultConfiguration();... 06 Feb 12 » Retrieve and print the graphic device information - import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; public class Main {   public static void main(String[] args) {     GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();     GraphicsDevice[] gs = ge.getScreenDevices();     for (int j = 0; j < gs.length; j++) {       GraphicsDevice gd = gs[j];       System.out.println("Device " + j + ": " + gd);... 06 Feb 12 » Get the available font names - import java.awt.Font; import java.awt.GraphicsEnvironment; public class Main {   public static void main(String[] args) {     GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();     Font[] fonts = ge.getAllFonts();     for (Font font : fonts) {       String fontName = font.getName();       String familyName = font.getFamily();       System.out.println("Font: " + fontName + "; family: " + familyName);... 06 Feb 12 » Get the available font family names - import java.awt.GraphicsEnvironment; public class Main {   public static void main(String[] args) {     GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();     String familyNames[] = ge.getAvailableFontFamilyNames();     for (String familyName : familyNames) {       System.out.println("Family names: " + familyName);     }   } }... 06 Feb 12 » Getting Amount of Free Accelerated Image Memory - import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.image.VolatileImage; public class Main {   public static void main(String[] argv) throws Exception {     GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();     GraphicsDevice[] gs = ge.getScreenDevices();     for (int i = 0; i < gs.length; i++) {       VolatileImage im = gs[i].getDefaultConfiguration()           .createCompatibleVolatileImage(1, 1);... 06 Feb 12