Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

oracle.jdevimpl.audit.swing
Class MessageDialog

java.lang.Object
  extended by oracle.jdevimpl.audit.swing.MessageDialog
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.ComponentListener, java.util.EventListener

public class MessageDialog
extends java.lang.Object
implements java.awt.event.ActionListener, java.awt.event.ComponentListener

A modal message dialog based on JOptionPane but with a simpler interface. The myriad of static create and show methods supplied by JOptionPane are replaced by a factory object with mutable properties and a show method.

The properties include the dialog type, the content, and the set of command button labels.

The dialog type is supplied as a constant of class MessageDialog.Type, and determines layout and icon. The types are the following:

      ERROR
        INFORMATION
        PLAIN       No icon.
        QUESTION
        WARNING
 

The content is supplied as Objects. The objects are displayed in a vertical stack in accordance with their type:

        Object[]    Displayed in a vertical stack in accordance with their type.
    Component   Displayed as supplied.
        Icon          Displayed in a JLabel.
    <other>  Displayed using its toString() in a JLabel.
 
The contents can be supplied in one call through setContent or piecemeal through addContent.

The commands are specified as an array of Objects, where the object can be either a String or a Component. Components (usually buttons) are placed in the dialog directly; for each string, a button is created and placed with the string as the text.

The show method indicates the command chosen by the user by returning the corresponding string or component. It returns null if the user closed the dialog without choosing a command.


Nested Class Summary
protected static class MessageDialog.OptionPane
           
static class MessageDialog.Type
           
 
Field Summary
static MessageDialog.Type ERROR
           
static MessageDialog.Type INFORMATION
           
static MessageDialog.Type PLAIN
           
static MessageDialog.Type QUESTION
           
static MessageDialog.Type WARNING
           
 
Constructor Summary
MessageDialog()
          Creates an option dialog.
MessageDialog(MessageDialog.Type type)
          Creates an option dialog of a specific type.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Handle the action performed event for a command supplied as a JButton.
 void addContent(java.lang.Object content)
          Adds content to the dialog.
 void componentHidden(java.awt.event.ComponentEvent e)
           
 void componentMoved(java.awt.event.ComponentEvent e)
           
 void componentResized(java.awt.event.ComponentEvent e)
           
 void componentShown(java.awt.event.ComponentEvent e)
           
 void setCommands(java.lang.Object command)
          Sets the command of the dialog.
 void setCommands(java.lang.Object[] commands)
          Sets the commands of the dialog.
 void setCommands(java.lang.Object command1, java.lang.Object command2)
          Sets the two commands of the dialog.
 void setContent(java.lang.Object content)
          Sets the content of the dialog.
 void setResizeable(boolean resizeable)
          Sets whether the dialog is resizeable.
 void setTitle(java.lang.String title)
          Sets the title of the dialog.
 void setType(MessageDialog.Type type)
          Sets the type of the dialog.
 java.lang.Object show()
          Show the dialog with a default parent.
 java.lang.Object show(java.awt.Component parent)
          Show the dialog.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR

public static final MessageDialog.Type ERROR

INFORMATION

public static final MessageDialog.Type INFORMATION

PLAIN

public static final MessageDialog.Type PLAIN

QUESTION

public static final MessageDialog.Type QUESTION

WARNING

public static final MessageDialog.Type WARNING
Constructor Detail

MessageDialog

public MessageDialog()
Creates an option dialog.


MessageDialog

public MessageDialog(MessageDialog.Type type)
Creates an option dialog of a specific type.

Parameters:
type - The type of the message, one of the following MessageDialog.Type constants:
                    ERROR
                    INFORMATION
                    PLAIN      No icon.
                    QUESTION
                    WARNING
 
See Also:
setType(oracle.jdevimpl.audit.swing.MessageDialog.Type)
Method Detail

addContent

public void addContent(java.lang.Object content)
Adds content to the dialog.

Parameters:
content - The content to be added to the dialog box.

setCommands

public void setCommands(java.lang.Object[] commands)
Sets the commands of the dialog.

Parameters:
commands - The command names or components.

setCommands

public void setCommands(java.lang.Object command)
Sets the command of the dialog. A convenience wrapper for setCommands(Object[]).

Parameters:
command - The command name or component.
See Also:
setCommands(java.lang.Object[])

setCommands

public void setCommands(java.lang.Object command1,
                        java.lang.Object command2)
Sets the two commands of the dialog. A convenience wrapper for setCommands(Object[]).

Parameters:
command1 - The first command name or component.
command2 - The second command name or component.
See Also:
setCommands(java.lang.Object[])

setContent

public void setContent(java.lang.Object content)
Sets the content of the dialog.

Parameters:
content - The content to be placed in the dialog box.

setResizeable

public void setResizeable(boolean resizeable)
Sets whether the dialog is resizeable.


setTitle

public void setTitle(java.lang.String title)
Sets the title of the dialog.

Parameters:
title - The title of the dialog.

setType

public void setType(MessageDialog.Type type)
Sets the type of the dialog.

Parameters:
type - The type of the message, one of the following MessageDialog.Type constants:
                    ERROR
                    INFORMATION
                    PLAIN      No icon.
                    QUESTION
                    WARNING
 

show

public java.lang.Object show()
Show the dialog with a default parent.

Returns:
The selected command, or null if none.

show

public java.lang.Object show(java.awt.Component parent)
Show the dialog.

Parameters:
parent - The parent component of this dialog.
Returns:
The selected command, or null if none.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Handle the action performed event for a command supplied as a JButton.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

componentHidden

public void componentHidden(java.awt.event.ComponentEvent e)
Specified by:
componentHidden in interface java.awt.event.ComponentListener

componentMoved

public void componentMoved(java.awt.event.ComponentEvent e)
Specified by:
componentMoved in interface java.awt.event.ComponentListener

componentResized

public void componentResized(java.awt.event.ComponentEvent e)
Specified by:
componentResized in interface java.awt.event.ComponentListener

componentShown

public void componentShown(java.awt.event.ComponentEvent e)
Specified by:
componentShown in interface java.awt.event.ComponentListener

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

Copyright © 1997, 2010, Oracle. All rights reserved.