This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting data from another jframe

 
prashant casfdasfsatg
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
E Armitage
Rancher
Posts: 989
9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do not have two top level components in the same program. Use one JFrame and add/remove different components (e.g JPanels) to it if you want to display different things.
 
prashant casfdasfsatg
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
E Armitage wrote:Do not have two top level components in the same program. Use one JFrame and add/remove different components (e.g JPanels) to it if you want to display different things.


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 responses.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic