participate


Java Game Development - changing the screen resolution
<<   Back to Forum  |   Give us Feedback
This topic has 5 replies on 1 page.
SlashOwNsU
Posts:38
Registered: 7/28/03
changing the screen resolution   
May 6, 2005 7:31 AM

 
hi...
I'm trying to show things in a full-screen window - resolution should be 800 x 600

it works fine on my computer (Pentium 633 w/ Windows 2000 with an old-*** Video card)
I tried it somewhere else (Windows XP w/ Athlon something with an all new Video card)

the problem that appears is that the screen doesn't change its resolution - instead it stays at resolution 1024 x 768 and any pixel beyond 800 x 600 appears black
basicly I have a screen with 75 % of it filled with what I want and the rest is black
ok...it's not that bad, but it sure looks ugly

here's the code that sets the display mode
GraphicsDevice dev = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); 
GraphicsConfiguration gc = dev.getDefaultConfiguration();
DisplayMode mode = new DisplayMode(800, 600, 32, DisplayMode.REFRESH_RATE_UNKNOWN);
JFrame frame = new JFrame(gc); 
frame.setUndecorated(true); 
frame.setIgnoreRepaint(true);
	    
frame.getContentPane().add(new MainPanel(), BorderLayout.CENTER);
	    
frame.show();
dev.setFullScreenWindow(frame); 
if(dev.isDisplayChangeSupported()) dev.setDisplayMode(mode); 
 
 
T10
Posts:64
Registered: 2/24/05
Re: changing the screen resolution   
May 7, 2005 3:02 AM (reply 1 of 5)  (In reply to original post )

 
If I were you I would try to use the same screen on both computers...
For information purpose only, there is screens that can't handle 800x600 pixels, they will show a small frame with 800x600 pixels and paints the rest black.
Normally this shouldn't be a problem with 800x600 since it's quite large, I have only had a hardware related problem with 640x480.

And then, while I'm not 100% sure about this sort of stuff but shouldn't you check which screen modes that's supported by the screen before setting a new DisplayMode and then pick the one that fits your purpose best?(using GraphicsDevice.getDisplayModes();).

Well, I'm afraid I'm not very coherent right now but it's before breakfast and it were a long day, um, today.
This is just to put some ideas that might help you to find a solution unless someone posts one.
GL
 
javaques@wonder
Posts:8
Registered: 10/25/05
Re: changing the screen resolution   
Nov 7, 2005 4:01 AM (reply 2 of 5)  (In reply to original post )

 
Hi

U have a experience of working in scree resolution in java.

Can u please solve my problem.When we change the resolution
is there any trigger fires....? if it fires what will be the trigger....

I want a code please ....But i get the Screen resolution in a simple way.
Now I want to know When it will change the resolution....?

please Any online person can also answer this please makeit fast .
this is very urgent......
 
T10
Posts:64
Registered: 2/24/05
Re: changing the screen resolution   
Nov 7, 2005 6:36 AM (reply 3 of 5)  (In reply to #2 )

 
1: I don't as such have much experience with the screen resolution mechanism with Java...

2: I don't think there is any events when you change resolution in full screen mode since it should be your own application that make the change.

3: If we're still talking about full screen mode you should be the one making that change...

Note
If your using a windows you might be interested in various events associated with windows(java.awr.event.*).

4: Unfortunately I can't give you any code samples at all since I'm, as always, in a bit of a hurry.

5: GL
 
shyam_queries
Posts:2
Registered: 7/28/06
Re: changing the screen resolution   
Jul 28, 2006 5:47 AM (reply 4 of 5)  (In reply to #3 )

 
Hi,

with the help of above code my problem of screen resolution is half solve
but....
problem with above code is when you apply on frame that's ok but if you add any JDialog to that frame then JDialog, and move JDialog with mouse dragged and dropped

then Jdialog is invisibly run .

you check this i you find any solution please post that it's urgent
 
HateJava
Posts:1
Registered: 6/24/07
Re: changing the screen resolution   
Jun 24, 2007 8:06 PM (reply 5 of 5)  (In reply to #4 )

 
HAHAAAAAAAAAAAAAAAAAAA !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

I hate java ! But, I found how to do this, i can't belive, for the first time i made it run whitout the red underline of death !!!!!!!!!!!!!!!!!!!!!!!

just put
gs.setDisplayMode(mode);

after setting on the fullscreen mode...

well, it runs in my computer, and it's windows XP
 
This topic has 5 replies on 1 page.
Back to Forum
 
Read the Developer Forums Code of Conduct

Click to email this message Email this Topic

Edit this Topic
  
 
 
Forums Statistics
    Users Online : 28
  • Guests : 133

About Sun forums
  • Oracle Forums is a large collection of user generated discussions. It is here to help you ask questions, find answers, and participate in discussions.

    Check out our guide on Getting started with Oracle Forums for a full walkthrough of how to best leverage the benefits of this community.

Powered by Jive Forums