Solved

JAVA New to GUIs - parsing objects between forms/GUIs

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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java Loop 6 62
java stored proc example 9 32
JAVA API design with micro service cloud in mind 1 20
Selenium docs api java index 3 20
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
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…
The viewer will learn how to implement Singleton Design Pattern in Java.
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.

831 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