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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:05:25+00:00 2026-06-15T09:05:25+00:00

How do I go about creating what I describe below? First, here is the

  • 0

How do I go about creating what I describe below?

First, here is the basic look of my GUI:

enter image description here

When I click on Add New Account I want to have the GUI pop up a small window where the user can enter log-in credentials. I would need this information to be passed back into the main GUI, so I am lost as how to approach this.

The same goes for Preferences or Remove Account. How do I go about creating a “GUI Overlay” of sorts. Sorry, I can’t figure out the correct terminology for the effect I am looking for.

I wanted to attempt to use JOptionPane‘s, but after some research this seemed like it was not the route to be taking.

I was also toying with the idea of creating a new JFrame when the action was preformed. How should this be approached?

  • 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-15T09:05:28+00:00Added an answer on June 15, 2026 at 9:05 am

    Start by using dialogs over frames. Dialogs are designed to gather small pieces of information from the user.

    I would create a separate component for each operation you want to perform. Within these components I would provide setters and getters to allow you to gain access to the information managed by the component.

    From there I would either use a JOptionPane or JDialog to display the component to the user. The reason for using one over the other for me comes down to begin able to control the action buttons (Okay and Cancel for example). For something like the login dialog, I want to restrict the user from begin able to hit the Login button until they’ve provided enough information to make the attempt.

    The basic follow would be something like this…

    LoginDialog dialog = new LoginDialog(SwingUtilities.getWindowAncestor(this)); // this is a reference any valid Component
    dialog.setModal(true); // I would have already done this internally to the LoginDialog class...
    dialog.setVisible(true); // A modal dialog will block at this point until the window is closed
    if (dialog.isSuccessfulLogin()) {
        login = dialog.getLogin(); // Login is a simple class containing the login information...
    }
    

    The LoginDialog might look something like this…

    public class LoginDialog extends JDialog {
        private LoginPanel loginPane;
        public LoginDialog(Window wnd) {
            super(wnd);
            setModal(true);
            loginPane = new LoginPanel();
            setLayout(new BorderLayout());
            add(loginPane);
            // Typically, I create another panel and add the buttons I want to use to it.
            // These buttons would call dispose once they've completed there work
        }
    
        public Login getLogin() {
            return loginPane.getLogin();
        }
    
        public boolean isSuccessfulLogin() {
            return loginPane.isSuccessfulLogin();
        }
    }
    

    The dialog is simply acting as proxy/container for the login pane.

    This is, of course an overview, you will need to fill in the blanks 😉

    Now, if you don’t want to go to the trouble of creating your own dialog, you can take advantage of the JOptionPane instead.

    LoginPanel loginPane = new LoginPanel();
    int option = JOptionPane.showOptionDialog(
         this, // A reference to the parent component
         loginPane,
         "Login", // Title
         JOptionPane.YES_NO_OPTION,
         JOptionPane.QUESTION_MESSAGE,
         null, // You can supply your own icon it if you want
         new Object[]{"Login", "Cancel"}, // The available options to the user
         "Login" // The "initial" option
         );
    if (option == 0) {
        // Attempt login...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been investigating about creating a UDP server, at first i though i
I have a question about GUI design, specifically with Java Swing and creating clean
I am thinking about creating my new asp.net mvc web application compatible with native
I am creating a basic msi project using installsheild 2012 premier. I have two
How would I go about creating a menu (complex, simple, etc - doesn't matter
how would i go about creating a many-many relationship among data objects in google
How do I go about creating my own taskbar toolbar, a la Windows Media
How do you go about creating a sphere with meshes in Direct-x? I'm using
How do I go about creating an atom feed in PHP?
I was thinking about creating an iPhone app front end for one of our

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.