• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

out.println vs. gui netbeans

 
Lenny Peter
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 49804
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Campbell Ritchie....I will try this
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic