class org.aswing.JOptionPane extends JPanel
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.
Class Fields
static function showInputDialog(title:String, msg:String, ?finishHandler:Dynamic ->Void = null?defaultValue:String = '', ?parentComponent:Component = null, ?modal:Bool = true, ?icon:Icon = null): 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 = __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.
title | the title of the box, can be null |
msg | the message , can be null |
finishHandler | the 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. |
defaultValue | the default value for the input |
parentComponent | determines the Frame in which the dialog is displayed; can be null |
modal | is the window modal, default is true |
icon | the icon, can be null |
static function showMessageDialog(title:String, msg:String, ?finishHandler:Dynamic ->Void = null?parentComponent:Component = null, ?modal:Bool = true, ?icon:Icon = null, ?buttons:Int = 1): 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 = __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.
@see #OK @see #CANCEL @see #YES @see #NO @see #CLOSE
title | the title of the box, can be null |
msg | the message , can be null |
finishHandler | the 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. |
parentComponent | determines the Frame in which the dialog is displayed; can be null |
modal | is the window modal, default is true |
icon | the icon, can be null |
buttons | which buttons need to show. |
closeBox | is close the box frame when user click buttons |