my dog learned polymorphism*
The moose likes Beginning Java and the fly likes out.println vs. gui netbeans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "out.println vs. gui netbeans" Watch "out.println vs. gui netbeans" New topic
Author

out.println vs. gui netbeans

Lenny Peter
Ranch Hand

Joined: Apr 22, 2008
Posts: 52
Hi

I can get PatientList in System.out.println(""), but not in gui window...why?







I have tried with...not good






Thanks

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38045
    
  22
Have you really got a class called Collections? Creating a class with the same name as a well known class in the API is a good way to cause confusion.

You are using the setText method on your text area, so you will only get the last patient. You ought to use an append or similar method. You ought also to override the toString() method or create a getFullName() method in the Patient class, so that is all you have to add to the text area.
Your method getAllPatients does not get all patients. It returns a String from the "Collections" object. The method is inappropriately named. It also does several things; a method should do one thing, so you ought to decide what exactly it should do.
Lenny Peter
Ranch Hand

Joined: Apr 22, 2008
Posts: 52
Thanks Campbell Ritchie....I will try this
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: out.println vs. gui netbeans
 
Similar Threads
update a JList based on an Array
problems printing from array list in hashmap
Networked Programs that work across countries
JTable problem
Getting JComponents