Here you can find the source of createAndShowErrorPanel(String title, Map
public static void createAndShowErrorPanel(String title, Map<String, String> messages)
//package com.java2s; // This software is licensed under the GNU General Public License, import java.awt.BorderLayout; import java.util.Map; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; import javax.swing.JTextPane; import javax.swing.ScrollPaneConstants; public class Main { public static void createAndShowErrorPanel(String title, Map<String, String> messages) { JPanel jp = new JPanel(new BorderLayout(0, 0)); jp.setPreferredSize(new java.awt.Dimension(640, 480)); JTabbedPane tabs = null;//from w ww . j a v a2s . c o m if (messages.size() > 1) { tabs = new JTabbedPane(); jp.add(tabs); } for (String key : messages.keySet()) { JTextPane tp = new JTextPane(); tp.setText(messages.get(key)); JScrollPane jpMessage = new JScrollPane(tp, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); if (messages.size() > 1) { tabs.add(key, jpMessage); } else { jp.add(jpMessage); } } JOptionPane.showMessageDialog(null, jp, title, JOptionPane.ERROR_MESSAGE); } }