PMH
PMH

Reputation: 85

What is property change value of JOptionPane and When it changes?

I see that when creating a customized dialog with JOptionPane, in the method propertyChange that handle property change events, people often check whether the current property value equals a certain value, say VALUE_PROPERTY. And after that they would check which button in the dialog the user choose.

So what is the property value?

Specifically, what is the meaning of VALUE_PROPERTY and INPUT_VALUE_PROPERTY?

What does a user do to change the property value?

Upvotes: 0

Views: 282

Answers (1)

Luis Lavieri
Luis Lavieri

Reputation: 4109

It is not that complicated. The show dialog method returns an integer. With this value you are able to understand what the user selected:

For instance,

YES_OPTION, means that the user clicked yes.

So, how is this translated to the logic?

If you were implementing a listener, you would do something like this:

if(the user selected yes)
    //do something

You can read more about it here:

https://docs.oracle.com/javase/7/docs/api/javax/swing/JOptionPane.html

Upvotes: 1

Related Questions