changing the screen resolution
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);
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
T10a at 2007-7-10 15:46:35 >

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......
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
T10a at 2007-7-10 15:46:35 >

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