Posted on

VGNBTGN

import javax.swing.*;

public class MyGUI {
    public static void main(String[] args) {
        JFrame frame = new JFrame("My First GUI");
        frame.setSize(400, 300);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        
        // Create components
        JLabel label = new JLabel("Welcome to GUI Programming!");
        JButton button = new JButton("Click me!");
        
        // Add components to the frame
        frame.setLayout(new FlowLayout()); // Set layout manager
        frame.add(label);
        frame.add(button);
        
        frame.setVisible(true);
    }
}