hello, two questions: how to vsync? and how to fullscreen? using graphics2D

hello, two questions: how to vsync? and how to fullscreen? using graphics2D
that’s my trouble.
I just started messing with this code: http://www.java-gaming.org/index.php/topic,21919.0.html
and works but looks horrible… :frowning: , I thing vsync could do the trick. But hot to do that? and Fullscreen.

Thanks in advance. ;D

	GraphicsEnvironment.getLocalGraphicsEnvironment().
                getDefaultScreenDevice().setFullScreenWindow(frame);

Example:


import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class FullScreenFrame {

    public static void main(String[] args){
        JFrame frame=new JFrame();
        frame.setFocusable(true);//focus the frame
    	frame.setUndecorated(true);//remove borders
        frame.setVisible(true);
        //set fullscreen
	GraphicsEnvironment.getLocalGraphicsEnvironment().
                getDefaultScreenDevice().setFullScreenWindow(frame);
        //set Escape listener
        frame.addKeyListener(new KeyListener(){
            public void keyPressed(KeyEvent e){
                if(e.getKeyCode()==KeyEvent.VK_ESCAPE){
                    System.exit(0);
                }
            }
            public void keyReleased(KeyEvent e){}
            public void keyTyped(KeyEvent e){}
        });
    }
}

If i remember correctly is vsync set automatically when u set fullscreen mode.
But u cant set vsync in windowed mode or in a applet, when you using java2D.

That’s interesting, I’ve always thought getting a full screen java application is alot harder than…2 lines of code XD.

I just tried it, it looks beautiful! Thanks for the code =)