MOA 12.03
Real Time Analytics for Data Streams
GUIUtils.java
Go to the documentation of this file.
00001 /*
00002  *    GUIUtils.java
00003  *    Copyright (C) 2007 University of Waikato, Hamilton, New Zealand
00004  *    @author Richard Kirkby (rkirkby@cs.waikato.ac.nz)
00005  *
00006  *    This program is free software; you can redistribute it and/or modify
00007  *    it under the terms of the GNU General Public License as published by
00008  *    the Free Software Foundation; either version 3 of the License, or
00009  *    (at your option) any later version.
00010  *
00011  *    This program is distributed in the hope that it will be useful,
00012  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *    GNU General Public License for more details.
00015  *
00016  *    You should have received a copy of the GNU General Public License
00017  *    along with this program. If not, see <http://www.gnu.org/licenses/>.
00018  *    
00019  */
00020 package moa.gui;
00021 
00022 import java.awt.Component;
00023 import java.awt.Dimension;
00024 
00025 import javax.swing.JOptionPane;
00026 import javax.swing.JScrollPane;
00027 import javax.swing.JTextArea;
00028 
00029 import moa.core.MiscUtils;
00030 
00037 public class GUIUtils {
00038 
00039     public static void showErrorDialog(Component parent, String title,
00040             String message) {
00041         JTextArea messagePanel = new JTextArea(message);
00042         JScrollPane messageScroll = new JScrollPane(messagePanel);
00043         messageScroll.setPreferredSize(new Dimension(400, 100));
00044         JOptionPane.showMessageDialog(parent, messageScroll, title,
00045                 JOptionPane.ERROR_MESSAGE);
00046     }
00047 
00048     public static void showExceptionDialog(Component parent, String title,
00049             Exception ex) {
00050         showErrorDialog(parent, title, ex.getMessage() + "\n\n"
00051                 + MiscUtils.getStackTraceString(ex));
00052     }
00053 }
 All Classes Namespaces Files Functions Variables Enumerations