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

  • Home
  • SEARCH
  • 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 8618547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:08:08+00:00 2026-06-12T06:08:08+00:00

So my question is, how do I make it so that the main class

  • 0

So my question is, how do I make it so that the main class doesn’t run while another class is waiting for input from the user.

Maybe I’m thinking it the wrong way so please help me sort out my thoughts 🙂

Here is a little example/snippet.

Main Class is running a JFrame and then opens up another JFrame asking user for inputs
the other JFrame is inside AddEditWindow class.

AddEditWindow temp = new AddEditWindow();

info[counter+1] = temp.newEditedInfo;

infoArray.add(info[counter+1]);

So pretty much, what I’m asking is, how do I make it so that it doesn’t reach the 2nd line of code until the user finally finishes inputting everything.

The ActionListener/Event handler for AddEditWindow is just for a button.

So i’m waiting for a button to be clicked (so that the variable inside the AddEditWindow class is initialized) and then for the code to continue to

info[counter+1] = temp.newEditedInfo;

Hopefully I explained it well enough.

Don’t know if I’m thinking about it wrong or what 😐

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

    For simplicity sake, try something like…

    int result = JOptionPane.showConfirmDialog(null, "Can I ask you a question", "Quesion", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
    switch (result) {
        case JOptionPane.YES_OPTION:
            //...
            break;
        case JOptionPane.NO_OPTION:
            //...
            break;
    }
    

    enter image description here

    The JOptionPane is a very powerful component. If you supply a component instead of the string, it will display the component…

    For example…

    enter image description here

    JPanel panel = new JPanel(new GridLayout(0, 2));
    panel.add(new JLabel("Name"));
    panel.add(new JLabel("Last"));
    panel.add(new JTextField("Jason"));
    panel.add(new JTextField("Cardanas"));
    panel.add(new JLabel("Phone"));
    panel.add(new JLabel("Email"));
    panel.add(new JTextField("333"));
    panel.add(new JTextField("X"));
    panel.add(new JLabel("PID"));
    panel.add(new JLabel("Donation"));
    panel.add(new JTextField("X"));
    panel.add(new JTextField("0"));
    panel.add(new JLabel("Membership"));
    panel.add(new JLabel("Points"));
    panel.add(new JTextField("false"));
    panel.add(new JTextField("0"));
    
    int result = JOptionPane.showConfirmDialog(null, panel, "Quesion", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
    switch (result) {
        case JOptionPane.OK_OPTION:
            //...
            break;
        case JOptionPane.CANCEL_OPTION:
            //...
            break;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, so I'll try to make that question a little more simple. The core
Short question: I'm trying to make that in a given page (uses tabs) back
Dumb question time: In the following request spec, I try to make sure that
There's another question: howto make diff look like svn diff? but I want the
I am editing the question to make it more specific. I want to run
I apologize in advance, if this question doesn't make sense. I'm a newbie. I
I have a stumper which doesn't seem to make sense. If I run the
The main culprit behind this question is of course IE6, (almost) everybody agrees that
After reading answer to this question: Make "make" default to "make -j 8" I
This might be a really stupid question and make you guys laugh. I've deployed

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.