001 /* 002 Copyright (C) 2003 Adam Olsen 003 004 This program is free software; you can redistribute it and/or modify 005 it under the terms of the GNU General Public License as published by 006 the Free Software Foundation; either version 1, or (at your option) 007 any later version. 008 009 This program is distributed in the hope that it will be useful, 010 but WITHOUT ANY WARRANTY; without even the implied warranty of 011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 012 GNU General Public License for more details. 013 014 You should have received a copy of the GNU General Public License 015 along with this program; if not, write to the Free Software 016 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 017 */ 018 019 package com.valhalla.gui; 020 021 import java.awt.*; 022 import java.util.*; 023 024 import javax.swing.*; 025 026 027 /** 028 * WaitDialog 029 * This is just a frame with a JLabel in it and no buttons 030 * used for displaying "Please wait..." dialogs and the like 031 * 032 * @author Adam Olsen 033 * @version 1.0 034 * 035 **/ 036 037 public class WaitDialog extends JDialog 038 { 039 /** 040 * Default constructor 041 * @param title the message to be displayed in the window's titlebar 042 * @param string the message to be displayed in the main window 043 **/ 044 public WaitDialog( String title, String string ) 045 { 046 setTitle( title ); 047 048 JPanel panel = (JPanel)getContentPane(); 049 panel.setLayout( new BorderLayout() ); 050 panel.setBorder( BorderFactory.createEmptyBorder( 30, 60, 30, 60 ) ); 051 052 JLabel label = new JLabel( string ); 053 054 panel.add( label, BorderLayout.CENTER ); 055 056 pack(); 057 setLocationRelativeTo( null ); 058 059 setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE ); 060 } 061 062 /** 063 * Single param constructor - passes string to <code>WaitDialog( String, String )</code> 064 * @param string the message to be displayed 065 **/ 066 public WaitDialog( String string ) 067 { 068 this( string, string ); 069 } 070 }