You are on page 1of 4

GOVERNMENT ENGINEERING COLLEGE

BILASPUR

PRESENTATION ON SUMMER TRAINING AT CRISP BHOPAL


SUBJECT- J2SE

GUIDED BY
ASST. PROF PRASHANT
VAISHNAV SIR
Java Swing
 It is a part of Foundation classes and comes under the
package javax.swing
 Used mainly for building Windows Based Application and
Graphical User Interfaces.
 It is built on the top of AWT (Abstract Window Toolkit) API
written in Java.
 AWT is a container containing textfields , buttons etc.
 A javax Swing package provides the java swing classes like :-
JButton , Jframe , Jtextfield , JRadioButton , JCheckBox
etc.
Program for Simple GUI Application using Swing.

package GUI;
import javax.swing*;

public class SwingExample {


public static void main(String []args)
{
JFrame j=new JFrame();
//creating instance of JFrame
JButton b=new JButton(“ Click Me ”); //creating instance of JButton
b.setBounds(130,100,100,40); // x,y,width,height
f.add(b);
//adding button in JFrame
f.setSize(400,500); //400
width and 500 height
f.setLayout(null); //making
Frame visible
f.setVisible(true);
}
}
Output

You might also like