How to Joptionpane the Showconfirmdialog dialog box button to set the monitor

Source: Internet
Author: User

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 user

Showconfirmdialog 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 ~ ~ ~

A very many method returns 0 under normal conditions, and returns 1 if it is not normal.

So I tested it with the following code, for example:


watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvbglhbmdjywl5dw4ymdez/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma== /dissolve/70/gravity/southeast ">

After I clicked Yes, there was a result:


The "Yes" button on the Description dialog box corresponds to an int value of 0

So don't set up the listener. Add the code that you want to complete directly in the IF.

Above just my humble, suppose through the great God has a better way, oh, I want to leave a message ~~!

Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.

How to Joptionpane the Showconfirmdialog dialog box button to set the monitor

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.