Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: getScreenSize() method giving java.awt.HeadlessException

  1. #1
    Junior Member
    Join Date
    Apr 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default getScreenSize() method giving java.awt.HeadlessException

    I am getting HeadlessException for getScreenSize() method.Please find the below sample code for more details.
    Dimension dim = null;
    try{
    dim = Toolkit.getDefaultToolkit().getScreenSize();
    }catch(Exception e){
    e.printStackTrace();
    }
    The getScreenSize() method is not working in Java 1.6.But it is working in 1.4.
    Recently we have upgraded the java to 1.6.

    Can you please help me on this issue ?|
    Last edited by helloworld922; April 15th, 2012 at 11:15 AM. Reason: please use [code] tags


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: getScreenSize() method giving java.awt.HeadlessException

    the posted code works for me with 1.6
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. giving arraylist name
    By iddheepak in forum Java Theory & Questions
    Replies: 1
    Last Post: November 27th, 2011, 02:08 PM
  2. xml parsing getting all subtags without giving it's name
    By HungryCoder in forum Java SE APIs
    Replies: 1
    Last Post: May 27th, 2011, 03:27 AM
  3. JavaCompilerobject giving an error WITHOUT ide
    By divs1210 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 2nd, 2011, 08:49 PM
  4. [SOLVED] Giving Java the name of a file to be read via command line?
    By lavloki in forum File I/O & Other I/O Streams
    Replies: 4
    Last Post: October 14th, 2010, 10:07 AM
  5. Replies: 0
    Last Post: March 5th, 2010, 01:32 AM