Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.Cursor;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;

public class Main extends JFrame {
    private void ShowDialog() {
        JLabel label = new JLabel("Move mouse here for hand cursor");
        label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        JOptionPane pane = new JOptionPane(label);
        pane.setOptions(new Object[] { "OK" });

        JDialog dialog = pane.createDialog(this, "Test Dialog");
        dialog.setVisible(true);
    }

    public static void main(String[] args) {
        Main testFrame = new Main();
        testFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        testFrame.setSize(500, 300);
        testFrame.setVisible(true);
        testFrame.ShowDialog();
    }
}