Common Methods of joptionpane prompt box xmloracleswing
Recently I encountered a message prompt box in a swing program. The joptionpane class encapsulates many methods.
It was very convenient, So I simply sorted it out.
1.1 showmessagedialog
A modal dialog box with the OK button is displayed.
The following are several examples of using showmessagedialog:Java code
Jopt
Recently I encountered a message prompt box in a swing program. The joptionpane class encapsulates many methods.
It was very convenient, So I simply sorted it out.
1.1 showmessagedialog
A modal dialog box with the OK button is displayed.
The following are several examples of using showmessagedialog:Java code
Joptionpane. showmessagedialog (null, "tip ");
The effect is as follows:
Java code
Address: http://847353020-qq-com.iteye.com/blog/954532
1.1 showmessagedialog
A modal dialog box with the OK button is displayed.
The following are several examples of using showmessagedialog:Java code
Joptionpane. showmessagedialog (null, "tip ");
The effect is as follows:
Java code
Joptionpane. showmessagedialog (jpanel, "message", "title", joptionpane. w
1.1 showMessageDialog
A modal dialog box with the OK button is displayed.
The following are several examples of using showMessageDialog:Java code
JOptionPane. showMessageDialog (null, "tip ");
The effect is as follows:
Java code
JOptionPane. showMessageDialog (jPanel, "message", "title", JOptionPane. WARNING_MESSAGE );
The effect is as follows:Java code
)(5) Icon: Icons to be displayed in the dialog box(6) MessageType (icon):Error_message, Information_message, Warning_message,Question_message, Plain_message,(7) Optiontype: Button options displayed at the bottom of the dialog box.Default_option, Yes_no_option, Yes_no_cancel_option, Ok_cancel_option.5, use Example:(1) Display MessagedialogJoptionpane.showmessagedialog (NULL, "message content to display", "title", Joptionpane.error_message);(2) Display ConfirmdialogJoptionpane.showconfirmdialog (N
Joptionpane usage -- Java
Simple Application of joptionpane:
1. first introduce the package:
Import javax. Swing. joptionpane;
2. Add the following code:
Object [] Options = {"OK", "cancel", "help "};
// Customize the available buttons
Int response = joptionpane. showoptiondialog (null, "This is an option dialog box. Y
Inherits the jdialog class. The first sentence of the constructor is super (owner, "title", modal );If modal is set to true, a mode dialog box is displayed. If modal is set to false, a mode-free dialog box is displayed.Package UI. Dialog;Import java. AWT. event. actionevent;Import java. AWT. event. actionlistener;Import java. AWT. event. componentadapter;Import java. AWT. event. componentevent;Import java. AWT. event. windowadapter;Import java. AWT. event. javaswevent;Import java. Beans. propert
In swing, based on business considerations, a dialog box is displayed to restrict user behaviors and prompt user actions.
Swing provides the joptionpane class to implement the MessageBox function similar to the Windows platform. It is also available in Java. Various static methods in the joptionpane class are used to generate various standard dialogs, this function displays information, raises questions, w
In a graphical user interface (GUI) environment, there are roughly two types of forms: the frame window and the Dialog form (dialog window). In Java, we use the JFrame object as the frame form, using the JDialog object as the dialog form. Here are some common ways to familiarize yourself with the Joptionpane class:1. Joptionpane class method for output--showmesagedialog ()Example (1)--Simple dialog window i
)(5) Icon: Icons to be displayed in the dialog box(6) MessageType (icon):Error_message, Information_message, Warning_message,Question_message, Plain_message,(7) Optiontype: Button options displayed at the bottom of the dialog box.Default_option, Yes_no_option, Yes_no_cancel_option, Ok_cancel_option.5, use Example:(1) Display MessagedialogJoptionpane.showmessagedialog (NULL, "message content to display", "title", Joptionpane.error_message);(2) Display ConfirmdialogJoptionpane.showconfirmdialog (N
The static factory method of the Joptionpane class primarily creates 4 types of dialog boxes1 showmessagedialog----Display a modal dialog box with OK button (only the currently popup dialog is executed)JAVA instance:Joptionpane.showmessagedialog (JL, "Welcome to our Store", "Dialog's title", Joptionpane.information_message);2 Showoptiondialog-----This function can change the text displayed on the button, and you can customize the optionsJava instance:
Source code and the followingExample:1, an error dialog box appears:Joptionpane.showmessagedialog (NULL, "This is the content", "This is the title", Joptionpane.error_message);2, display an information panel with the options "yes/no":Joptionpane.showconfirmdialog (NULL, "This is the content", "This is the title", Joptionpane.yes_no_option);3, a warning dialog box is displayed with the options OK, CANCEL:object[] options = {"OK", "Cancel"};Joptionpane.showoptiondialog (NULL, "This is the content"
1 //addition program, Joptionpane for input and output.2 3 ImportJavax.swing.JOptionPane;4 5 Public classaddition{6 Public Static voidMain (string[] args) {7String Firstnumber=joptionpane.showinputdialog ("Enter First integer!");8 9String Secondnumber=joptionpane.showinputdialog ("Enter second integer!");Ten One intnum1=Integer.parseint (firstnumber); A intNum2=Integer.parseint (secondnumber); - - intsum=num1+num2; the -Joptionp
The Joptionpane class encapsulates a number of methods.Very convenient, so simple to tidy up a bit.1.1 ShowmessagedialogDisplays a modal dialog box with an OK button.Here are a few examples of using Showmessagedialog:Java code
Joptionpane.showmessagedialog (NULL, "friendly hints");
The effect is as follows:Java code
Joptionpane.showmessagedialog (JPanel, "hint message", "title", Joptionpane.warning_message);
The effect is a
The Joptionpane class has 4 static methods for displaying dialog boxes :Message, options, Confirmation, Input dialog boxshowMessageDialog://显示一条消息并等待用户OKshowConfirmDialog://显示一条消息并等待用户确认//显示一条消息并获得一组选项的选择showInputDialog: //显示一条消息并获得输入的一行文本The message dialog box has the following methods:Parentcomponet//Parent ComponentMassage//Message Object displayed in dialog box (string, icon, component or array)Title//dialog box titleMessageType//message type, de
Only recently did you know Javagui programming. I think, write a notepad independently, to set the Monitor in the dialog box of the button. But looking for the API the corresponding method has been found, only to find:Returns:An integer indicating the option selected by the userShowconfirmdialog This method simply returns an int value to identify which button is selected by the user. Looking for a half day also did not find the way to set up monitoring ...。。Just then ....。 A flash of inspiration
1, belong to Javax.swing package.
2, Function: Customize four different kinds of standard dialog box.
Confirmdialog Confirmation dialog box. Ask the question and then confirm by the user (press "Yes" or "No" button)
Inputdialog Prompt to enter
Android custom controls-custom properties, android Custom Controls
Reprinted please indicate the source:Http://blog.csdn.net/allen315410/article/details/39343401
When customizing android components, apart from using Java to build components, we sometimes need to declare some "attributes" for the project to use, so what is the component property?For example, when
Respect the original, reproduced please specify the source: http://blog.csdn.net/cyp331203/article/details/40855377Before:Android custom Control Series II: Custom Switch button (I ) and Android custom control series three: Custom switch button (ii) continue, Today is about how to use
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.