Java JOptionPane Info flashInfoMessage(final Component sourceComponent, final String message, int durationInMilliSecs)

Here you can find the source of flashInfoMessage(final Component sourceComponent, final String message, int durationInMilliSecs)

Description

flash Info Message

License

Open Source License

Declaration

public static void flashInfoMessage(final Component sourceComponent, final String message,
            int durationInMilliSecs) 

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.*;

public class Main {
    public static void flashInfoMessage(final Component sourceComponent, final String message,
            int durationInMilliSecs) {
        JOptionPane pane = new JOptionPane(message, JOptionPane.INFORMATION_MESSAGE);
        final JDialog dialog = pane.createDialog(null, "Info message");

        Timer timer = new Timer(durationInMilliSecs, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                dialog.setVisible(false);
                dialog.dispose();//from  w w  w . j a  v a  2 s .c om
            }
        });
        timer.setRepeats(false);
        timer.start();
        dialog.setVisible(true);
        dialog.dispose();
    }
}

Related

  1. displayInfoPane(Component parentComponent, String message)
  2. displayInformation(String strMsg)
  3. displayInformationMessage(Component parentComponent, String message, String windowTitle)
  4. getIconInformation()
  5. info(Component component, String title, String msg)
  6. info(Component parent, String message)
  7. info(Component parent, String message)