Solved

Passing data in java between panels

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
numbers ascending pyramid 101 193
ArrayIndexOutOfBoundException 9 80
javap not working 8 44
servlet example 17 29
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
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…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

776 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