by Dinesh Thakur Category: Swing

Frame is the most common container used to create top-level window having title, border and window-management buttons. It can also be used to create secondary windows for an application. A frame is an object of JFrame class.

The constructors defined by this class JFrame class are as follows.

JFrame ()

JFrame(String title)


title specifies the title for the frame

Example :

import java.awt.*;

import javax.swing.*;
public class JFrameColor extends JFrame
    private final int SIZE = 100;
    private Container cntnr = getContentPane();
    private JButton BtnClckHere = new JButton("Click Here");
    public JFrameColor()
       super("JFrame Color in Java Swing Example");
       cntnr.setLayout(new FlowLayout());
       public static void main(String[] args)
            JFrameColor frame = new JFrameColor();

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.

Related Articles