Free Data Structures and Algorithms Course

Subscribe below and get all best seller courses for free !!!


Subscribe to all free courses

How to Create a Simple Frame using Swing API in Java?.

In order to create our Simple frame using Swing Application Programming Interface in Java , we have to deal with JFrame class in Java , present in the package javax.swing.* ;. This program will display just the title on the window frame after running the program.

Program to demonstrate Simple Frame creation using Swing API in Java

package com.hubberspot.awtSwing.example;

import javax.swing.*;

public class SimpleFrame
  JFrame frame;
    frame = new JFrame("Welcome to HubberSpot frame");
  public static void main(String[] args)
 new SimpleFrame();

Output of the program :

The output of the program is the simple GUI window having close , minimize and maximixe buttons at the top right of the frame . The window component is a simple frame having nothing to display . The frame in above example will contain a simple window having title displayed as : “ Welcome to HubberSpot frame ” .
© 2021 Learn Java by Examples Template by Hubberspot