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 8345161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:35:43+00:00 2026-06-09T06:35:43+00:00

I need to create and display several multiple choices dialogs. Those are dialogs with

  • 0

I need to create and display several multiple choices dialogs. Those are dialogs with 3 or more buttons, like for instance “copy/move/link”, or “replace/overwrite/ignore”, that sort of thing.

I’m stuck with three competing implementation ideas, and none of them seems good enough:

  • Creating dialogs for each problem, and returning the result as an enum,
  • Creating a dynamic dialog that takes a vararg of String, turn them into buttons using the String as labels, and return the selected String as a result.
  • Creating a dialog that take a vararg of DialogChoice, an interface I would create with a getText() method for the label and an act() method that is called when the DialogChoice is selected.

The first one will obviously produce redundant code, but the return type of the second one is quite dirty. The third seems the best so far, but it looks like some kind of disguised functional code and I’m not sure if that’s the healthy OO way of doing things.

So, is there another solution that I omitted, am I completely reinventing the wheel, or is one of these three ideas the best one?

Edit : I’m using JavaFx so there’s no built-in mechanisms that I could reuse, but it’s more of a general question that can be adapted to multiple frameworks, or even multiple languages. I only included the Java tag so as not to confuse people with the “enum” and “interface” keywords.

  • 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-06-09T06:35:44+00:00Added an answer on June 9, 2026 at 6:35 am

    “The third seems the best so far, but it looks like some kind of disguised functional code”

    What makes you say that? It sounds oop to me.

    A DialogChoice corresponds to an action and has a description. You encapsulate that in an object that lives on its own and is reusable.

    The only “problem” is that it might increase verbosity, using anonymous classes and/or Runnables…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create a panel to display a long radiobutton form with a
I need to create a TreeView type controller that will display rich text. Example:
I need to create interface MultiLingual, that allows to display object's data in different
I have several places where I need to display an alert and handle the
I need to create several combo boxes to represent enumeration values. I want the
I have several tables from which I need to display data. Schools ------- id
I need to display all the employees in one webpart. I created the gridview
I need to display a multiply sign (×) in a modal being created by
I need create custom dialog and put JPanel into it. Is it possible?
i need create an email list sending to many emails. what is best solution

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.