user2044918
user2044918

Reputation:

Disable NO_BUTTON from JOptionPane Java if a condition is true

I used showConfirmDialog method from JOptionPane with the options: YES_NO_CANCEL. How can I have access and disable NO_BUTTON if a condition is true? Thank you!

Upvotes: 0

Views: 98

Answers (2)

christopher
christopher

Reputation: 27346

Why not just show a different type of dialog if said condition is true?

if(canCancel)
{
    JOptionPane.showConfirmDialog(" blah blah blah ");
}
else
{
    JOptionPane.showMessageDialog(" blah blah blah ");
}

Upvotes: 2

dirtydexter
dirtydexter

Reputation: 1073

As far as I know this is impossible without overriding JOptionPane.

Try searching for swinglabs or jGoodies libraries for Java. They have built in type for the thing you need.

Upvotes: 0

Related Questions