import uc.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class MsgWindow extends JFrame { public MsgWindow( String text, final boolean killOnExit ) { setTitle( "Unsolicited Commando Message" ); setSize( 300, 300 ); getContentPane().setLayout( new BorderLayout() ); JPanel topPanel = new JPanel(); topPanel.setLayout( new BorderLayout() ); getContentPane().add( topPanel, BorderLayout.CENTER ); JTextArea area = new JTextArea( text ); area.setBackground( new Color( 0, 0, 0, 255 ) ); area.setForeground( new Color( 255, 0, 0, 255 ) ); area.setFont( new Font( "courier", 0, 12 ) ); area.setLineWrap( true ); area.setWrapStyleWord( true ); JScrollPane scrollPane = new JScrollPane(); scrollPane.getViewport().add( area ); scrollPane.setBounds( 10, 10, 300, 300 ); topPanel.add( scrollPane, BorderLayout.CENTER ); this.addWindowListener( new WindowAdapter() { public void windowClosing( WindowEvent e ) { if( killOnExit ) System.exit( 0 ); } } ); } }