Pages

JFrame fullscreen

Source code below will show you, how to set JFrame to full screen follow to current computer screen

*************************************************************************
COMPLETE SOURCE CODE FOR : FullScreenJFrame.java
*************************************************************************


import javax.swing.JFrame;

import java.awt.Toolkit;

public class FullScreenJFrame
{
public static void main(String[]args)
{
//Create a JFrame with title ( Full Screen JFrame )
JFrame frame=new JFrame("Full Screen JFrame");

//Set default close operation for JFrame
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

//Set JFrame size to full screen size follow current screen size
frame.setSize(Toolkit.getDefaultToolkit().getScreenSize().width,Toolkit.getDefaultToolkit().getScreenSize().height);

//Make JFrame visible
frame.setVisible(true);
}
}


*************************************************************************
JUST COMPILE AND EXECUTE IT
*************************************************************************
Related Posts Plugin for WordPress, Blogger...