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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "out.println vs. gui netbeans" Watch "out.println vs. gui netbeans" New topic

out.println vs. gui netbeans

Lenny Peter
Ranch Hand

Joined: Apr 22, 2008
Posts: 52

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

I have tried with...not good


Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46320
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
It's not a secret anymore!