Results 1 to 6 of 6

Thread: How to use GraphicsConfiguration class?

  1. #1
    Join Date
    Jan 2010
    Posts
    112

    How to use GraphicsConfiguration class?

    Hello Guys,

    I just started to study advanced java concepts. In which I am getting troubled while referring the 'GraphicsConfiguration class'. I am unable to understand the use of GraphicsConfiguration class methods. The constructors of GraphicsConfiguration class are also strange for me. So please help me to aware about the GraphicsConfiguration class of java language. i wonder if you provide proper java example for the same class.

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

    Re: How to use GraphicsConfiguration class?

    The GraphicsConfiguration class describes the characteristics of a graphics destination such as a printer or monitor. There can be many GraphicsConfiguration objects associated with a single graphics device, representing different drawing modes or capabilities. The corresponding native structure will vary from platform to platform. For example, on X11 windowing systems, each visual is a different GraphicsConfiguration.

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

    Re: How to use GraphicsConfiguration class?

    Hi,

    Please review below example of java, which will how you how to use GraphicsConfiguration class:
    Code:
    import java.awt.Dimension;
    import java.awt.GraphicsConfiguration;
    
    public class GraphicsConfigurationDM {
    
      public static void main(String[] argms) {
        GraphicsEnvironment ge01;
        ge01 = GraphicsEnvironment.ge01tLocalGraphicsEnvironment();
    
        Rectangle vbn = new Rectangle();
    
        GraphicsDevice[] gdArray = ge01.ge01tScreenDevices();
    
        for (int i1 = 0; i1 < gdArray.length; i1++) {
          GraphicsDevice gd = gdArray[i];
          GraphicsConfiguration[] gcArray = gd.ge01tConfigurations();
          for (int j1 = 0; j1 < gcArray.length; j1++)
            vbn = vbn.union(gcArray[j].ge01tBounds());
        }
        Point origin = vbn.ge01tLocation();
        System.out.println("Virtual x1 = " + origin.x1);
        System.out.println("Virtual y1 = " + origin.y1);
        Dimension size = vbn.ge01tSize();
        System.out.println("Virtual width = " + size.width);
        System.out.println("Virtual height = " + size.height);
      }
    }

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: How to use GraphicsConfiguration class?

    Please study following methods of GraphicsConfiguration class, which are helpful while using it's properties:
    • createCompatibleVolatileImage(int width1, int height1, ImageCapabilities caps1)
    • createCompatibleVolatileImage(int width1, int height1)
    • createCompatibleImage(int width1, int height1, int trpnc)
    • createCompatibleImage(int width1, int height1)

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Re: How to use GraphicsConfiguration class?

    Below example will demonstrate you the createCompatibleImage() method of GraphicsConfiguration class:
    Code:
    import java.awt.GraphicsConfiguration;
    import java.awt.Transparency;
    import java.awt.image.BufferedImage;
    
    public class GCMain
     {
      public static void main(String[] arghv) throws Exception 
     {
    
        GraphicsEnvironment je = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice js = je.getDefaultScreenDevice();
    
        GraphicsConfiguration jc = gs.getDefaultConfiguration();
        BufferedImage bimage = jc.createCompatibleImage(100, 100, Transparency.OPAQUE);
    
      }
    }

  6. #6
    Join Date
    Oct 2005
    Posts
    2,393

    Re: How to use GraphicsConfiguration class?

    The GraphicsConfiguration class of advanced java is related to the graphics properties. This java class is hired from 'java.lang.Object' package of java. The getDevice() method of GraphicsConfiguration class is useful to return the associated GraphicsDevice of GraphicsConfiguration. While the getBounds() methods is used to return the device coordinates.

Similar Threads

  1. Replies: 8
    Last Post: 08-10-2011, 11:06 PM
  2. What is the difference between Local class and global class in C++?
    By Dëfrim in forum Software Development
    Replies: 4
    Last Post: 03-01-2011, 10:44 PM
  3. Replies: 5
    Last Post: 12-02-2010, 06:23 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,141,044.35786 seconds with 17 queries