Results 1 to 6 of 6

Thread: What is the use of GraphicsEnvironment class?

  1. #1
    Join Date
    Jan 2010
    Posts
    70

    What is the use of GraphicsEnvironment class?

    Hi All,

    I need you help to sort out my query related to the GraphicsEnvironment class of java programming language. This GraphicsEnvironment class sounds very complicated to understand. Even I don't have any idea about it's methods and properties also. I wonder if anybody let me know something about the GraphicsEnvironment class of the java with a suitable java code . I would appreciate your help.

  2. #2
    Join Date
    May 2008
    Posts
    2,389

    Re: What is the use of GraphicsEnvironment class?

    The GraphicsEnvironment class describes the collection of GraphicsDevice objects and Font objects available to a Java(tm) application on a particular platform. The resources in this GraphicsEnvironment might be local or on a remote machine. GraphicsDevice objects can be screens, printers or image buffers and are the destination of Graphics2D drawing methods. Each GraphicsDevice has a number of GraphicsConfiguration objects associated with it.

  3. #3
    Join Date
    Feb 2008
    Posts
    1,852

    Re: What is the use of GraphicsEnvironment class?

    Below I have given the java example, which will depict you the use of GraphicsEnvironment class:
    Code:
    import java.awt.GraphicsEnvironment;
    import java.awt.Font;
    
    public class GPEClass 
    
    {
      public static void main(String[] argms) throws Exception 
    {
        Font[] fonts1  = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
        for (int iy = 0; iy < fonts.length; iy++) 
        {
          System.out.print(fonts1[iy].getFontName() + " : ");
          System.out.print(fonts1[iy].getFamily() + " : ");
          System.out.print(fonts1[iy].getName());
          System.out.println();
        }
      }
    }

  4. #4
    Join Date
    Jan 2008
    Posts
    1,521

    Re: What is the use of GraphicsEnvironment class?

    Hello friend,

    You should be aware about following methods of GraphicsEnvironment class before accessing it's properties:
    • getAvailableFontFamilyNames(Locale lcl)
    • isHeadlessInstance()
    • createGraphics(BufferedImage BFimg)
    • getMaximumWindowBounds()
    • getCenterPoint()

  5. #5
    Join Date
    Apr 2008
    Posts
    1,948

    Re: What is the use of GraphicsEnvironment class?

    Example of GraphicsEnvironment class:
    Code:
    import java.awt.GraphicsDevice;
    import java.awt.GraphicsEnvironment;
    import java.awt.GraphicsConfiguration;
    
    public class GraphicENClass
    
     {
      public static void main(String[] args) {
        GraphicsEnvironment gez = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice defaultScreen = gez.getDefaultScreenDevice();
        GraphicsConfiguration[] configurations = defaultScreen.getConfigurations();
    
        System.out.println("Default screen device: " + defaultScreen.getIDstring());
        for (int iz = 0; iz < configurations.length; iz++) {
     
         System.out.println("  Configuration " + (iz + 1));
     
         System.out.println("  " + configurations[iz].getColorModel());
        }
      }
    }

  6. #6
    Join Date
    May 2008
    Posts
    2,012

    Re: What is the use of GraphicsEnvironment class?

    A GraphicsEnvironment class is used for description of the objects of GraphicsDevice class. you can use only one constructor of GraphicsEnvironment class. The java package from which this class is hired is 'java.lang.Object'. You can use the constructor of GraphicsEnvironment class, but cannot instantiated because of it's abstract type behavior. This java class is used where the functionality of GraphicsDevice class is not applicable.

Similar Threads

  1. Replies: 8
    Last Post: 08-10-2011, 11:06 PM
  2. Replies: 5
    Last Post: 12-02-2010, 06:23 PM
  3. Difference among concrete class and abstract class
    By Roxy_jacob in forum Software Development
    Replies: 4
    Last Post: 07-12-2009, 01:22 PM
  4. Ultra solid drives:Imation M-Class and S-Class
    By Regina in forum Portable Devices
    Replies: 1
    Last Post: 03-04-2009, 10:34 AM
  5. Good news for CBSE CLASS X & CLASS IX - visit learnnext
    By surya_expert in forum Education Career and Job Discussions
    Replies: 0
    Last Post: 13-12-2008, 12:09 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,152,128.55483 seconds with 16 queries