JFrame Class
Frames are a powerful feature of swing. You can create a windows for your application by using the resizable border. To create a frame window. you use the constructor of the JFrame class. The constructor accepts the title of the frame as a parameter. The string is displayed on the title bar of the frame window.
JFrame frame = new JFrame (“Frame Window”);
Once you create a frame thn u use add() method to add components to it. You can diplay a frame window by invoking the setVisible() method you can specify how a frame windows should close using the setDefaultCloseOperation() will exit the application on closing the frame windows. You should use the JFrame.EXIT_ON_CLOSE option only for application
Example
import javax.swing.*;
public class Customer
{
static JFrame frame;
public static void main(String args[])
{
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVIsible(true);
frame.setSize(300,300);
}
}


No comments
Category: