Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6834769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:09:09+00:00 2026-05-26T23:09:09+00:00

Good ol’ JOptionPane contains a plethora of static methods. There are many combinations, yet

  • 0

Good ol’ JOptionPane contains a plethora of static methods. There are many combinations, yet to change certain options (like buttons) you still must specify other optional arguments – often defaults (like a null icon). This doesn’t lead to easy to read code.

Moreover the methods aren’t particularly consistent (does an int return correspond to a ***_OPTION constant or a button index?) so it requires a slew of documentation to disambiguate: it’s not quick & easy to learn, remember or write.

It would seem natural to me to create a ‘Builder’ wrapper. It might look something like this:

String[] buttonText = { "Looks good", "It sucks" };

Object selection = new OptionPaneBuilder("What do you think?")
    .question()
    .message(messageComponent)
    .resizable(true)
    .showOptionDialog(parent, buttonText);

return buttonText[0].equals(selection);

The final method call could be:

// returns int (or enum?)
.showConfirmDialog(parent, JOptionPane.YES_NO_CANCEL_OPTION) 

// returns JOptionPane
.build()

// etc... 

I’m happy to go write it – but my failure to find anything existing makes me wonder: am I crazy (it’s a bad idea / there are better ways) … or just inept at using Google? 🙂

So… does anyone know of anything that achieves something like this?

My feeling is to stick with JOptionPane dialogs so that the UI delegates gets things like fonts and system icons correct for any Look and Feel; but I guess if alternatives succeed at this, they would be fine too.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:09:10+00:00Added an answer on May 26, 2026 at 11:09 pm

    There is an API called oxbow TaskDialogs. It includes some decent standard Task-Dialog-Layouts and you are also able to design your own ones. Within this API you are free to use their static methods to create a standard dialog, as well as using their builder to construct the desired dialog.

    Example with builder pattern:

    int choice =
        TaskDialogs
            .build( owner, "What do you think?",
                "You have to choose, either this dialog looks good or it just sucks!" )
            .title( "Make a decision!" )
            .choice( 0,
                new CommandLink( "Looks good", "With good I mean it looks reaaaally awesome!" ),
                new CommandLink( "It sucks", "I cant see it anymore, take it away!" ) );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good morning, I have mysql queries where I would like to calculate percentage of
Good day, just a quick question: I would like to bind a table to
Good day, I have like 15 images I need to be buttons. I have
Good morning! Is possible or had some plugin to change color in the email
Good day, I need to extract portion of string which can looks like this:
Good day, I have a hibernate mapping which goes something like this <class name=Person>
Good morning. I realize there are a ton of questions out there regarding replace
Good Day all , I am having this problem since many days now ,
Good day. I would like to know if it is possible to apply styles
Good day. I need to teach Windows CryptoAPI to encrypt the message with private

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.