Solved

Passing data in java between panels

Posted on 2009-03-30
1
345 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
[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
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

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…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This video teaches viewers about errors in exception handling.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

617 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