Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

public class Main {
    public static void displayErrorMessage(JFrame frame, String errorMessage) {
        // create a JTextArea
        JTextArea textArea = new JTextArea(6, 25);
        textArea.setText(errorMessage);
        textArea.setEditable(false);

        // wrap a scrollpane around it
        JScrollPane scrollPane = new JScrollPane(textArea);

        // display them in a message dialog
        // TODO i don't know if this will work if this is null
        JOptionPane.showMessageDialog(frame, scrollPane);
    }
}