Solved

JAVA New to GUIs - parsing objects between forms/GUIs

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Protect jar file - windows app 2 38
Java array passed to SQL where clause 23 62
Java - Why doesn't this JFrame work 3 41
GUI builder for Eclipse? 8 27
Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

911 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

19 Experts available now in Live!

Get 1:1 Help Now