Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-27-2012, 07:37 PM   PM User | #1
javarower
New to the CF scene

 
Join Date: Feb 2012
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
javarower is an unknown quantity at this point
Full Screen Not Working

I am making a full screen gui and then putting a picture on it. I can get the picture to display in windowed mode however whenever i display it in full screen it does not work.
Here is the code I use for making it full screen:
[CODE]
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = ge.getDefaultScreenDevice();
GraphicsConfiguration gc = gd.getDefaultConfiguration();
gd.setFullScreenWindow( frame );
if( gd.isDisplayChangeSupported() ) {
gd.setDisplayMode(
new DisplayMode( 640, 480, 32, DisplayMode.REFRESH_RATE_UNKNOWN )
);
} [CODE]



Here is my full code:

[CODE]
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.image.ImageProducer;
import java.io.*;
import javax.imageio.ImageIO;
import javax.swing.*;

public class **** extends Canvas{
Image image;

public ****() {
MediaTracker media = new MediaTracker(this);
image = Toolkit.getDefaultToolkit().getImage("pokemon.png");
media.addImage(image, 0);
try {
media.waitForID(0);
}
catch (Exception e) {}
}

public ****(ImageProducer imageProducer){
image = createImage(imageProducer);
}

public void paint(Graphics g) {
g.drawImage(image, 0,0, this);
Graphics2D g2d = null;

}

public static void main(String args[]) {
Frame frame = new Frame();
frame.setLayout(new BorderLayout());
frame.add("Center", new ****());
frame.resize(400,400);
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = ge.getDefaultScreenDevice();
GraphicsConfiguration gc = gd.getDefaultConfiguration();
gd.setFullScreenWindow( frame );
if( gd.isDisplayChangeSupported() ) {
gd.setDisplayMode(
new DisplayMode( 640, 480, 32, DisplayMode.REFRESH_RATE_UNKNOWN )
);
}
frame.show();
}
}
[CODE]
javarower is offline   Reply With Quote
Old 02-28-2012, 12:46 AM   PM User | #2
javarower
New to the CF scene

 
Join Date: Feb 2012
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
javarower is an unknown quantity at this point
Oh sry my class was named **** spelled 's' 'h' 'i' 't' and that is why the class names are **** and the constructor is ****() and it goes new ****().
javarower is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:51 AM.


Advertisement
Log in to turn off these ads.