Solved

JAVA New to GUIs - parsing objects between forms/GUIs

Posted on 2007-04-01
4
317 Views
Last Modified: 2013-12-14
How can I communicate/parse objects from one open form/GUI to another.
In other words I would like to change some settings using one form, close it, and then parse these changed settings to the original form.

This would therefore be similar to the JFileChooser form where you are given a return value.

Could someone point me in the right direction ?

Thanks



0
Comment
Question by:mr_mooray
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 10

Accepted Solution

by:
ADSLMark earned 250 total points
ID: 18831891
Assume you start with a FrameMain, where you click on a button. This button creates a dialog, like EditDialog. When you close this dialog, you want to update the components in the FrameMain.

So how would you go about this. Well one common approach is to use Model-View-Controller pattern for your FrameMain. This FrameMain is a view of some model (your data) and you can have several controllers which modify this model. Now when you create the dialog EditDialog, you can pass the model along (in the constructor) and then you can directly modify the model when the dialog is closed. Next you only have to repaint the FrameMain, and this view will be updated.

If you need more information about MVC (Model-view-controller), just search google. I can do it for you, but I think you are more than capable of doing it yourself.

Mark
0
 
LVL 30

Assisted Solution

by:Mayank S
Mayank S earned 250 total points
ID: 18832390
Create a Settings class for all the settings that you need to pass from one frame to the other, containing all the data members with get/ set methods so it becomes like a VO (value object). Pass this value object from one form to another either as part of the a state of a singleton state-manager or by sending it to the constructor as Mark says.
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question