Hello i am trying to Create the beginning of a full screen game and i am having issues. I want a blue background with white text and the entire screen to be changed to 800*600. The problem is i get a screen with an 800*600 box in the middle(not visible but i can tell by mouse boundaries) and my background is black.

My Code:
import java.awt.*;
import javax.swing.JFrame;
/**
* Write a description of class Full here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Full extends JFrame
{
public static void main(String[] args){
DisplayMode dm = new DisplayMode(800,600,16, DisplayMode.REFRESH_RATE_UNKNOWN);
Full full = new Full();
full.run(dm);
}
public void run(DisplayMode dm){
setBackground(Color.BLUE);
setForeground(Color.WHITE);
setFont(new Font("Arial", Font.PLAIN,24));
Screen s = new Screen();
try{
s.setFullScreen(dm,this);
try{
Thread.sleep(15000);
}catch(Exception ex){}
}finally{
s.restoreScreen();
}
}
public void paint(Graphics g){
if(g instanceof Graphics2D){
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
}
g.drawString("This is gonna be awesome!!",200,200);
}
}
public class Screen
{
private GraphicsDevice vc;
Window myWindow;
public Screen(){
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
vc = env.getDefaultScreenDevice();
}
public void setFullScreen(DisplayMode dm, JFrame myWindow){
myWindow.setUndecorated(true);
myWindow.setResizable(false);
vc.setFullScreenWindow(myWindow);
if(dm != null && vc.isDisplayChangeSupported()){
try{
vc.setDisplayMode(dm);
}catch(Exception ex){}
}
}
public Window getFullScreenWindow(){
return vc.getFullScreenWindow();
}
public void restoreScreen(){
Window w = vc.getFullScreenWindow();
if(w != null){
w.dispose();
}
vc.setFullScreenWindow(null);
}
}
This is a short answer, because it seems that you are on the wrong trace 🙂
Games should be using OpenGL or DirectX, so the graphical work is done by the GPU. I strongly recommend OpenGL, since it is compatible with every platform. The way you started, the game will run completely on the CPU, which is not good.
Take a look at LWJGL (LightWeight Java Game Library). It is a cross-platform library that allows you to use OpenGL. It will require some Googling for tutorials, but it is really worth it. Your performance of the game will be a lot better, and your game will be made the way it has to be. Just to give you an idea, Minecraft is made with LWJGL.
OpenGL allows you to make a quick start with your game development, using some simple methods, which is good first a first game experience. Later on, you will find out how to do things more efficient, but that would be too much information to start of with 😀
Good luck!