Solved

Passing data in java between panels

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupSum5 challenge 5 71
Printing to a specific printer tray (HP 806dn printer) 3 83
Core Java. What output will be and why ? 6 66
servlet example 17 5
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…
Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
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…

867 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

13 Experts available now in Live!

Get 1:1 Help Now