Set JFrame size

Source code below will show you, how to set JFrame size

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


import javax.swing.JOptionPane;
import javax.swing.JFrame;

public class SetSizeForJFrame
{
public static void main(String[]args)
{
//Receive user input for JFrame width
String jframeWidth=JOptionPane.showInputDialog(null,"Put JFrame width in pixels here");

//Receive user input for JFrame height
String jframeHeight=JOptionPane.showInputDialog(null,"Put JFrame height in pixels here");

//Create a JFrame
JFrame frame=new JFrame("Set JFrame size");

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

//Set JFrame size base on user input
frame.setSize(Integer.parseInt(jframeWidth),Integer.parseInt(jframeHeight));

//Make JFrame visible. So we can see it
frame.setVisible(true);
}
}


*********************************************************************
JUST COMPILE AND EXECUTE IT
*********************************************************************

RELAXING NATURE VIDEO