Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Getting data from another jframe

  1. #1
    Junior Member
    Join Date
    Dec 2013
    Thanked 0 Times in 0 Posts

    Default Getting data from another jframe

    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
    Super Moderator
    Join Date
    Jun 2013
    So. Maryland, USA
    My Mood
    Thanked 698 Times in 680 Posts

    Default Re: Getting data from another jframe

    Yes, showing some code would be helpful. Show the "calling block" in the 1st JFrame and as much of the code of the 2nd JFrame to show how the value you want to share is captured and stored or communicated to the 1st JFrame.

    I'm also wondering about this statement, "This is because 2nd Jframe starts working only when calling block in 1st JFrame executes completely," which may be based on some behavior you've observed, so it would be helpful if you'd describe that better.

    Using a JFrame for the second dialog may not be optimal. A JDialog may be better, but show the code and we'll talk more about that.

Similar Threads

  1. Replies: 2
    Last Post: July 9th, 2013, 06:01 PM
  2. insert data through gui application (JFrame)
    By muzammil786 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 26th, 2013, 08:30 AM
  3. problem with my JFrame; JFrame not closing and stay in background
    By golominator in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 6th, 2012, 08:20 AM
  4. List methods add(int k, Data data), set(int k, Data data), remove(int k)
    By Enirox in forum Object Oriented Programming
    Replies: 3
    Last Post: September 20th, 2012, 06:43 AM
  5. Problem retreving data from another JFrame in Java
    By phabion in forum Java Networking
    Replies: 3
    Last Post: March 19th, 2012, 09:59 AM

Tags for this Thread