Solved

JAVA New to GUIs - parsing objects between forms/GUIs

Posted on 2007-04-01
4
287 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
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:mayankeagle
mayankeagle 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now