Results 1 to 3 of 3
  1. #1
    myers.pa is offline Member
    Join Date
    Apr 2011
    Posts
    1
    Rep Power
    0

    Default Combination of Threads and Frames

    I wasn't sure if I should post this under Threads and Synchronization or AWT/Swing because I feel like it falls under both categories. I apologize if it's in the wrong one :eek:

    Here's the scenario though:

    I have a JFrame with a number of JPanels on it. When you click on one of the JPanels, it needs to open up another JFrame from which I need to prompt the user for a series of values. I'm trying to avoid using JOptionPanes for all of the inputs as I my JFrame can get all of the inputs at once and theoretically pass them as an array??

    My question is this, how can I halt the original JFrame/JPanel until the the user has entered their input and clicked ok, since those values need to be used in the original JFrame/JPanel.

    I'm not really asking for specific source code just maybe some ideas or suggestions about how to approach the problem.

    I've tried using a synchronize block on the original frame to halt it while the input JFrame would call notify after it has gathered it's input. But it didn't work out.

    To simplify the problem its basically this:

    Create a JFrame and have it display something
    Open another JFrame and use it to gather some input
    Display that data on the first JFrame

    Thanks for any help!!
    Last edited by myers.pa; 04-17-2011 at 01:05 AM.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by myers.pa View Post
    I have a JFrame with a number of JPanels on it. When you click on one of the JPanels, it needs to open up another JFrame from which I need to prompt the user for a series of values. I'm trying to avoid using JOptionPanes for all of the inputs as I my JFrame can get all of the inputs at once and theoretically pass them as an array??
    A JOptionPane can hold a complex GUI as its Object parameter, and so can a JDialog, both of which would likely be better than a second JFrame.

    My question is this, how can I halt the original JFrame/JPanel until the the user has entered their input and clicked ok, since those values need to be used in the original JFrame/JPanel.
    Use a JOptionPane or modal JDialog. Feel free to create a complex GUI in a JPanel and display it in the option pane or dialog.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. JScrollPane and GridBagLayout combination
    By lmpeders in forum AWT / Swing
    Replies: 0
    Last Post: 03-21-2011, 03:42 PM
  2. random linear combination of packet
    By bhatti in forum Networking
    Replies: 0
    Last Post: 12-22-2010, 04:46 PM
  3. Replies: 9
    Last Post: 05-05-2010, 05:33 PM
  4. Key combination
    By dejos456 in forum New To Java
    Replies: 9
    Last Post: 11-30-2009, 08:11 AM
  5. COMBINATION TEXT..help me..urgent
    By conv_bay in forum New To Java
    Replies: 10
    Last Post: 04-28-2009, 12:34 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •