Java JOptionPane Message createPane(Component comp, String msg)

Here you can find the source of createPane(Component comp, String msg)

Description

create Pane

License

Open Source License

Declaration

public static void createPane(Component comp, String msg) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.Timer;

public class Main {
    public static void createPane(Component comp, String msg) {
        JOptionPane pane = new JOptionPane(msg);
        final JDialog dialog = pane.createDialog(comp, "INFORMATION");

        Timer timer = new Timer(4000, new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                dialog.dispose();/* w  w  w .  j  ava 2s  .  c o  m*/
            }
        });

        timer.setRepeats(false);
        timer.start();
        dialog.show();
        timer.stop();
        dialog.show(false);
    }
}

Related

  1. browse(String url, Component msgParent)
  2. browse(String url, Component msgParent)
  3. chooseIndex(String message, String messageTitle, Object[] objects, Object initialObject)
  4. chooseObject(String message, String messageTitle, Object[] objects, Object initialObject)
  5. copyToClipBoard(String code, boolean displayMessage)
  6. createPane(int type, String message, int messageMaxLength)
  7. debug(String message)
  8. display2(Component parent, String message, String title, int optionType, int messageType, Icon icon)
  9. displayEditor(Component parent, String title, String msg)