edu.rice.cs.util.swing
Class ScrollableDialog

java.lang.Object
  extended by edu.rice.cs.util.swing.ScrollableDialog
Direct Known Subclasses:
DrJavaScrollableDialog

public class ScrollableDialog
extends Object

Manages a JDialog with a scrollable text area and a button panel.

Version:
$Id: ScrollableDialog.java 5175 2010-01-20 08:46:32Z mgricken $

Field Summary
protected  JPanel _buttonPanel
          Panel of buttons at the bottom of this dialog.
protected  JDialog _dialog
          JDialog managed by this component.
private  Action _okAction
          A default "OK" action which disposes this dialog when invoked.
protected  JTextArea _textArea
          JTextArea contained in a scroll pane in this dialog.
protected  JScrollPane _textScroll
          ScrollPane that contains the text area.
static int DEFAULT_HEIGHT
          Default height for all ScrollableDialogs.
static int DEFAULT_WIDTH
          Default width for all ScrollableDialogs.
 
Constructor Summary
ScrollableDialog(JFrame parent, String title, String header, String text)
          Creates a new ScrollableDialog with the default width and height.
ScrollableDialog(JFrame parent, String title, String header, String text, boolean wrap)
          Creates a new ScrollableDialog with the default width and height.
ScrollableDialog(JFrame parent, String title, String header, String text, int width, int height)
          Creates a new ScrollableDialog.
ScrollableDialog(JFrame parent, String title, String header, String text, int width, int height, boolean wrap)
          Creates a new ScrollableDialog.
 
Method Summary
protected  void _addButtons()
          Adds buttons to this dialog's button panel.
 void setTextFont(Font f)
          Sets the font for the text area in this dialog.
 void show()
          Shows this dialog.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_WIDTH

public static final int DEFAULT_WIDTH
Default width for all ScrollableDialogs.

See Also:
Constant Field Values

DEFAULT_HEIGHT

public static final int DEFAULT_HEIGHT
Default height for all ScrollableDialogs.

See Also:
Constant Field Values

_dialog

protected JDialog _dialog
JDialog managed by this component.


_textArea

protected JTextArea _textArea
JTextArea contained in a scroll pane in this dialog.


_buttonPanel

protected JPanel _buttonPanel
Panel of buttons at the bottom of this dialog.


_textScroll

protected JScrollPane _textScroll
ScrollPane that contains the text area.


_okAction

private Action _okAction
A default "OK" action which disposes this dialog when invoked.

Constructor Detail

ScrollableDialog

public ScrollableDialog(JFrame parent,
                        String title,
                        String header,
                        String text)
Creates a new ScrollableDialog with the default width and height.

Parameters:
parent - Parent frame for this dialog
title - Title for this dialog
header - Message to display at the top of this dialog
text - Text to insert into the scrollable JTextArea

ScrollableDialog

public ScrollableDialog(JFrame parent,
                        String title,
                        String header,
                        String text,
                        int width,
                        int height)
Creates a new ScrollableDialog.

Parameters:
parent - Parent frame for this dialog
title - Title for this dialog
header - Message to display at the top of this dialog
text - Text to insert into the scrollable JTextArea
width - Width for this dialog
height - Height for this dialog

ScrollableDialog

public ScrollableDialog(JFrame parent,
                        String title,
                        String header,
                        String text,
                        boolean wrap)
Creates a new ScrollableDialog with the default width and height.

Parameters:
parent - Parent frame for this dialog
title - Title for this dialog
header - Message to display at the top of this dialog
text - Text to insert into the scrollable JTextArea
wrap - whether to wrap long lines

ScrollableDialog

public ScrollableDialog(JFrame parent,
                        String title,
                        String header,
                        String text,
                        int width,
                        int height,
                        boolean wrap)
Creates a new ScrollableDialog.

Parameters:
parent - Parent frame for this dialog
title - Title for this dialog
header - Message to display at the top of this dialog
text - Text to insert into the scrollable JTextArea
width - Width for this dialog
height - Height for this dialog
wrap - whether to wrap long lines
Method Detail

_addButtons

protected void _addButtons()
Adds buttons to this dialog's button panel. Subclasses can override this to add different buttons.


setTextFont

public void setTextFont(Font f)
Sets the font for the text area in this dialog.

Parameters:
f - New font for the text

show

public void show()
Shows this dialog.