net.sf.jaxodraw.gui
Class JaxoDialogs

java.lang.Object
  extended by net.sf.jaxodraw.gui.JaxoDialogs

public final class JaxoDialogs
extends Object

A convenience class for user input dialogs. The common 'parent' Component argument is the Component whose Window to use as owner for the dialog. It may be 'null' (history, it was), but this should be avoided in future.

Since:
2.0

Method Summary
static String getDescription(Component parent, String old)
          Opens a dialog to choose a new description for a graph.
static String getNewTabName(Component parent, String oldName)
          Pops up a JOptionPane to allow the user to enter some text.
static String getText(Component parent)
          Opens a dialog to enter a text.
static JDialog newDialog(Component aparent, String title, boolean modal)
          A new JDialog with the first Dialog/Frame ancestor as owner and the given arguments.
static JPanel newLineBoxLayoutPanel()
          A new JPanel with LINE_AXIS BoxLayout.
static JPanel newPageBoxLayoutPanel()
          A new JPanel with PAGE_AXIS BoxLayout.
static JPanel newTitledBorderLayoutPanel(String key)
          A new JPanel with BorderLayout and a titled (translated) border.
static JPanel newTitledFlowLayoutPanel(String key)
          A new JPanel with FlowLayout and a titled (translated) border.
static JPanel newTitledLayoutPanel(String key, LayoutManager l)
          A new JPanel with the given layout and a titled (translated) border.
static JPanel newTitledLineBoxLayoutPanel(String key)
          A new JPanel with LINE_AXIS BoxLayout and a titled (translated) border.
static JPanel newTitledPageBoxLayoutPanel(String key)
          A new JPanel with PAGE_AXIS BoxLayout and a titled (translated) border.
static void showErrorDialog(Component parent, String message)
          Shows a simple MessageDialog to display an error message.
static void showErrorDialog(Component parent, String message, String title)
          Shows a simple MessageDialog to display an error message.
static void showI18NErrorDialog(Component parent, String messageKey)
          Shows a simple MessageDialog to display an error message.
static void showInfoDialog(Component parent, String message, String title)
          Shows a simple MessageDialog to display an info message.
static void showMiniDialog(Component parent, String title, Object contents, ActionListener l)
          Show 'contents' in a new modal dialog with title 'title' and owner determined by 'parent'; adding "OK" and "Cancel" buttons.
static String translatedWindowTitle(String text)
          Format a text that is already translated as a window title (usually, adding prefix).
static String windowTitle(JaxoDictionary d, String key)
          Like JaxoDictionary.value(String), but format as a window title (usually, adding prefix).
 String windowTitle(JaxoDictionary d, String key, Object[] arguments)
          Like JaxoDictionary.message(String,Object[]), but format as a window title (usually, adding prefix).
static String windowTitle(String key)
          Like JaxoLanguage.translate(String), but format as a window title (usually, adding prefix).
static String windowTitle(String key, Object[] arguments)
          Like JaxoLanguage.message(String,Object[]), but format as a window title (usually, adding prefix).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

translatedWindowTitle

public static String translatedWindowTitle(String text)
Format a text that is already translated as a window title (usually, adding prefix).

Parameters:
text - The title text.
Returns:
The formatted title.

windowTitle

public static String windowTitle(String key)
Like JaxoLanguage.translate(String), but format as a window title (usually, adding prefix).

Parameters:
key - The key of the title text.
Returns:
The formatted title.

windowTitle

public static String windowTitle(String key,
                                 Object[] arguments)
Like JaxoLanguage.message(String,Object[]), but format as a window title (usually, adding prefix).

Parameters:
key - The key of the title text.
arguments - An array of arguments.
Returns:
The formatted title.

windowTitle

public static String windowTitle(JaxoDictionary d,
                                 String key)
Like JaxoDictionary.value(String), but format as a window title (usually, adding prefix).

Parameters:
d - The dictionary for the title text.
key - The key of the title text.
Returns:
The formatted title.

windowTitle

public String windowTitle(JaxoDictionary d,
                          String key,
                          Object[] arguments)
Like JaxoDictionary.message(String,Object[]), but format as a window title (usually, adding prefix).

Parameters:
key - The key of the title text.
d - The dictionary for the title text.
arguments - An array of arguments.
Returns:
The formatted title.

newDialog

public static JDialog newDialog(Component aparent,
                                String title,
                                boolean modal)
A new JDialog with the first Dialog/Frame ancestor as owner and the given arguments.

Parameters:
aparent - The parent component.
title - The dialog title.
modal - True to make the dialog modal.
Returns:
The dialog.

showMiniDialog

public static void showMiniDialog(Component parent,
                                  String title,
                                  Object contents,
                                  ActionListener l)
Show 'contents' in a new modal dialog with title 'title' and owner determined by 'parent'; adding "OK" and "Cancel" buttons. If the user chooses "OK", the ActionListener argument is notified.

Parameters:
parent - The parent component.
title - The title.
contents - The dialog contents.
l - The actionlistener to notify if the dialog is approved. If l is null, this method returns without bringing up the dialog.

showErrorDialog

public static void showErrorDialog(Component parent,
                                   String message,
                                   String title)
Shows a simple MessageDialog to display an error message.

Parameters:
parent - The parent component.
message - The message to display.
title - The window title.

showErrorDialog

public static void showErrorDialog(Component parent,
                                   String message)
Shows a simple MessageDialog to display an error message.

Parameters:
parent - The parent component.
message - The message to display.

showInfoDialog

public static void showInfoDialog(Component parent,
                                  String message,
                                  String title)
Shows a simple MessageDialog to display an info message.

Parameters:
parent - The parent component.
message - The message to display.
title - The window title.

showI18NErrorDialog

public static void showI18NErrorDialog(Component parent,
                                       String messageKey)
Shows a simple MessageDialog to display an error message. The actual message is looked up in one of the resource bundles defined by JaxoDraw via the given messageKey.

Parameters:
parent - The parent component.
messageKey - The ResourceBundle key to look up the message.

getNewTabName

public static String getNewTabName(Component parent,
                                   String oldName)
Pops up a JOptionPane to allow the user to enter some text.

Parameters:
parent - The parent component.
oldName - The old tab name.
Returns:
The entered text string.

getDescription

public static String getDescription(Component parent,
                                    String old)
Opens a dialog to choose a new description for a graph.

Parameters:
parent - The parent component.
old - The old description.
Returns:
The entered text string, or null if the dialog was canceled.

getText

public static String getText(Component parent)
Opens a dialog to enter a text.

Parameters:
parent - The parent component.
Returns:
The entered text string.

newLineBoxLayoutPanel

public static JPanel newLineBoxLayoutPanel()
A new JPanel with LINE_AXIS BoxLayout.

Returns:
A new JPanel.

newPageBoxLayoutPanel

public static JPanel newPageBoxLayoutPanel()
A new JPanel with PAGE_AXIS BoxLayout.

Returns:
A new JPanel.

newTitledLineBoxLayoutPanel

public static JPanel newTitledLineBoxLayoutPanel(String key)
A new JPanel with LINE_AXIS BoxLayout and a titled (translated) border.

Parameters:
key - The key of the title.
Returns:
A new JPanel.

newTitledPageBoxLayoutPanel

public static JPanel newTitledPageBoxLayoutPanel(String key)
A new JPanel with PAGE_AXIS BoxLayout and a titled (translated) border.

Parameters:
key - The key of the title.
Returns:
A new JPanel.

newTitledFlowLayoutPanel

public static JPanel newTitledFlowLayoutPanel(String key)
A new JPanel with FlowLayout and a titled (translated) border.

Parameters:
key - The key of the title.
Returns:
A new JPanel.

newTitledBorderLayoutPanel

public static JPanel newTitledBorderLayoutPanel(String key)
A new JPanel with BorderLayout and a titled (translated) border.

Parameters:
key - The key of the title.
Returns:
A new JPanel.

newTitledLayoutPanel

public static JPanel newTitledLayoutPanel(String key,
                                          LayoutManager l)
A new JPanel with the given layout and a titled (translated) border.

Parameters:
key - The key of the title.
l - The LayoutManager to use.
Returns:
A new JPanel.


Copyright © 2003-2011 The JaxoDraw team. All Rights Reserved.