Class org.aswing.JOptionPane

Description

JOptionPane makes it easy to pop up a standard dialog box that prompts users for a value or informs them of something.

There's some shortcut to do there with static methods like showMessageDialog, showInputDialog. But if you want to make a hole control of JOptionPane, you can create a JOptionPane by yourself and append it into a your JFrame.

See Also

Field Index

CANCEL, CANCEL_STR, CLOSE, CLOSE_STR, NO, NO_STR, OK, OK_STR, YES, YES_STR

Inherited from Container

Inherited from Component

Inherited from EventDispatcher

Method Index

new JOptionPane()
getCancelButton(), getCloseButton(), getFrame(), getInputText(), getNoButton(), getOkButton(), getYesButton(), showInputDialog(), showMessageDialog()

Inherited from JPanel

Inherited from Container

Inherited from Component

Inherited from EventDispatcher

Constructor Detail

JOptionPane

public function JOptionPane()

Field Detail

OK_STR

static public OK_STR:String

CANCEL_STR

static public CANCEL_STR:String

YES_STR

static public YES_STR:String

NO_STR

static public NO_STR:String

CLOSE_STR

static public CLOSE_STR:String

OK

static public OK:Number

CANCEL

static public CANCEL:Number

YES

static public YES:Number

NO

static public NO:Number

CLOSE

static public CLOSE:Number

Method Detail

getFrame

public function getFrame():JFrame

getInputText

public function getInputText():JTextField

getOkButton

public function getOkButton():JButton

getCancelButton

public function getCancelButton():JButton

getYesButton

public function getYesButton():JButton

getNoButton

public function getNoButton():JButton

getCloseButton

public function getCloseButton():JButton

showMessageDialog

static public function showMessageDialog(title:String, msg:String, finishHandler:Function, parentComponent:Component, modal:Boolean, icon:Icon, buttons:Number):JOptionPane

showMessageDialog(title:String, msg:String, finishHandler:Function, parentComponent:Component, modal:Boolean, icon:Icon, buttons:Number)
showMessageDialog(title:String, msg:String, finishHandler:Function, parentComponent:Component, modal:Boolean, icon:Icon)
showMessageDialog(title:String, msg:String, finishHandler:Function, parentComponent:Component, modal:Boolean)
showMessageDialog(title:String, msg:String, finishHandler:Function, parentComponent:Component)
showMessageDialog(title:String, msg:String, finishHandler:Function)

Show a message box with specifield title, message, and icon.

for example:

 var handler:Function = Delegate.create(this, __whenUserConformed);
 var pane:JOptionPane = showMessageDialog("title", "is that OK?", handler, null, JOptionPane.YES|JOptionPane.NO);
 
will show a message box with yes and no buttons.

Parameters

titlethe title of the box, can be null
msgthe message , can be null
finishHandlerthe function(result:Number) to call when user finished input, will pass a number as parammeter, its value indicate what user's selection. For example CANCEL indicate that user pressed CANCEL button, CLOSE indicate that user pressed CLOSE button or just closed the frame by click frame's close button, YES indicate that user pressed the YES button etc.
parentComponentdetermines the Frame in which the dialog is displayed; can be null
modalis the window modal, default is true
iconthe icon, can be null
buttonswhich buttons need to show.

See Also

showInputDialog

static public function showInputDialog(title:String, msg:String, finishHandler:Function, defaultValue:String, parentComponent:Component, modal:Boolean, icon:Icon):JOptionPane

showMessageDialog(title:String, msg:String, finishHandler:Function, defaultValue:String, parentComponent:Component, modal:Boolean, icon:Icon)
showMessageDialog(title:String, msg:String, finishHandler:Function, defaultValue:String, parentComponent:Component, modal:Boolean)
showMessageDialog(title:String, msg:String, finishHandler:Function, defaultValue:String, parentComponent:Component)
showMessageDialog(title:String, msg:String, finishHandler:Function, defaultValue:String)
showMessageDialog(title:String, msg:String, finishHandler:Function)

Show a message box with specifield title, message, and icon and a TextField to requare user to input a string.

for example:

 var handler:Function = Delegate.create(this, __whenUserEntered);
 var pane:JOptionPane = showMessageDialog("title", "Please enter your name:", handler, "yournamehere");
 
will show a message box with OK and CANCEL and a input Texts.

Parameters

titlethe title of the box, can be null
msgthe message , can be null
finishHandlerthe function(result:String) to call when user finished input, will pass a string as parammeter, if it is null indicate that user had pressed cancel or just closed the frame, otherwise it is the string what user entered.
defaultValuethe default value for the input
parentComponentdetermines the Frame in which the dialog is displayed; can be null
modalis the window modal, default is true
iconthe icon, can be null