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 3 of 3

Thread: Adjusting Screen Resolution

  1. #1
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Adjusting Screen Resolution

    Hi everyone,

    I wanted to know if it is possible to set the Screen Resolution at the start of my program. The main window for my program is 1250 by 815 and I want to be able to display all of it on the user's screen. I do NOT want to use the Full Screen mode, since the user often needs to reference other documents while they are working with the program.

    Any suggestions and help is appreciated.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Adjusting Screen Resolution

    After a quick google search I found this post, which seems pretty promising: How to set screen resolution (Game Development forum at JavaRanch)
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Adjusting Screen Resolution

    Unfortunately, that method only works if you have a full screen app, and there's no equivalent for changing the "native" (non-full screen) resolution in pure Java*. Furthermore, there's only a limited number of resolutions you can change the monitor to. If someone's monitor is big enough, you can use a larger monitor to ensure that your window fits, but if the maximum resolution on their monitor is smaller, there's nothing you can do about it (ex. some monitors have a maximum resolution of 1024*768, therefore it's impossible for you to adjust the resolution above that even with native code).

    *note: when I say only works in full screen mode, I mean only works safely in full screen mode. The JVM implementation must support it for each specific OS, which unfortunately is not the case. I know the Sun JVM for Windows will only let change the resolution of full screen applications, otherwise you'll get an UnsupportedOperationException. I can't remember where I read/heard this, but I think the only OS's which do support this operation for non-full screen mode are Linux and Solaris (don't take my word for this, though).
    Last edited by helloworld922; April 22nd, 2011 at 08:17 PM.

Similar Threads

  1. Screen Resolution
    By bartonn in forum Member Introductions
    Replies: 2
    Last Post: December 16th, 2010, 06:49 AM
  2. Adjusting Size of JPanel to Boundaries of Painting
    By aussiemcgr in forum Java Theory & Questions
    Replies: 6
    Last Post: November 22nd, 2010, 01:17 PM
  3. DNS Resolution
    By nim.izadi in forum Java Theory & Questions
    Replies: 0
    Last Post: November 6th, 2010, 02:25 PM
  4. clear screen.
    By chronoz13 in forum Java Theory & Questions
    Replies: 10
    Last Post: December 5th, 2009, 07:27 AM
  5. Help with adjusting a program. NEw to java!!!!!
    By raidcomputer in forum Loops & Control Statements
    Replies: 1
    Last Post: September 27th, 2009, 08:05 PM