Solved

JAVA New to GUIs - parsing objects between forms/GUIs

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
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…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses

739 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