Solved

Passing data in java between panels

Posted on 2009-03-30
1
339 Views
Last Modified: 2013-11-23
I am writing a GUI that has many panels that are displayed through a controlPanel class.  I have one panel that gets half the information for a new patient (called newPatientPanel) and then a new screen is called (called newPatientContPanel) to get the remainder of the new patient data (too much data to get to fit on one panel).  Currently I can get the data entered on the newPatientPanel by creating many different get<VariableName> methods in newPatientPanel and having a corresponding set<VariableName> in the controlPanel and calling the set<VariableName> in the newPatientContPanel.  It works, but I'm thinking there has got to be a better way.  Can anyone point me in a better direction?  Thanks!
0
Comment
Question by:mtnrunner2001a
1 Comment
 
LVL 17

Accepted Solution

by:
Thomas4019 earned 125 total points
ID: 24025261
I think this could be simplified by making a custom object that you then pass around. Then you could either access the data directly in this object, or you could make get,set methods for each thing.
class PatientData

{

    ArrayList<String> someArray;

    String someName;

    int otherData;

}

Open in new window

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

760 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