Results 1 to 4 of 4
  1. #1
    prashant is offline Member
    Join Date
    Dec 2008
    Posts
    19
    Rep Power
    0

    Default Getting data from another jframe

    Hi,
    I am working on a program in which i have 2 jframes.
    From 1st JFrame i am calling 2nd JFrame.
    Now when 2nd Jframe is made visible( i have a simple button on 2nd frame) on clicking a button on it i store some value in my variable in 2nd frame and disable 2nd JFrame.
    Problem in this is, the value i get from 2nd Jframe variable is not correct or rather default value. This is because 2nd Jframe starts working only when calling block in 1st JFrame executes completely.

    Please tell me how can i get data from 2nd JFrame only after setting value.
    Also tell me if you didn't get the question i will try to put snippet.
    Thank you.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,900
    Rep Power
    25

    Default Re: Getting data from another jframe

    Please make a small, complete program that compiles, executes and shows the problem.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,236
    Rep Power
    7

    Default Re: Getting data from another jframe

    An application should only have a single JFrame.

    In you case the child window should probably be a modal JDialog. The code after the dialog.setVisible(true) does not execute until the dialog is closed, therefore you will be able to access the updated value at that time.

  4. #4
    prashant is offline Member
    Join Date
    Dec 2008
    Posts
    19
    Rep Power
    0

    Default Re: Getting data from another jframe

    Hi thanks for your help.
    I have got the solution for this problem instead of using a new JFrame or JPanel I used JDialog.
    When using JDialog the parent frame stops its execution until child dialog is set invisible.

    Thanks for your responces.

Similar Threads

  1. Replies: 2
    Last Post: 12-22-2013, 11:20 AM
  2. jDialog and JFrame Data Troubles
    By yetibdhrana in forum New To Java
    Replies: 1
    Last Post: 01-24-2012, 12:53 PM
  3. Replies: 6
    Last Post: 04-12-2010, 12:33 PM
  4. Passing data from one JFrame to another JFrame
    By tarami in forum New To Java
    Replies: 3
    Last Post: 08-06-2009, 06:44 PM
  5. Passing data from one JFrame to another
    By abhiN in forum New To Java
    Replies: 2
    Last Post: 03-28-2008, 06:39 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
  •