Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.BorderLayout;

import javax.swing.JButton;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;

public class Main {

    public static void main(String[] args) {
        JDesktopPane dp = new JDesktopPane();
        JInternalFrame inf = new JInternalFrame("Help", true, true, true, true);
        inf.setSize(200, 200);
        inf.setVisible(true);
        dp.add(inf);

        JButton btn = new JButton("Click");
        btn.addActionListener(e -> JOptionPane.showInternalInputDialog(inf, "Hit me"));
        inf.add(btn);

        JFrame f = new JFrame();
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setLayout(new BorderLayout());
        f.add(dp);
        f.setSize(400, 400);
        f.setVisible(true);
    }

}