Wednesday, 4 November 2015

Java Program to display a JFrame

JFrame is a class of package javax,swing.It is imported first.Then the JFrame class object is made.
Some properties are added to it .It is required to display JFrame.

setvisible function for making JFrame visible
setsize function for setting size of frame
"welcome" is passed as parameter as title of the JFrame

Program requirements :Jdk 7 or above (at least) ,notepad++ editor,command prompt.
settings :Environment variables should be set.

Program:

import javax.swing.JFrame;

class myFrame
{

  public static void main(String[] args)
  {

     JFrame f1 = new JFrame("Welcome");
     f1.setSize(400,400);
     f1.setVisible(true);

   }
}


Output


No comments:

Post a Comment