• Post Reply Bookmark Topic Watch Topic
  • New Topic

Component Container  RSS feed

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my application I have severl Components (JTextFields, JTextAreas, etc). I am going to need to hand these all over to another class for manipulation and I thought that if I just shoved all these in a Container (Hashmap, HashTable, etc) then I could just hand that over to the other class.
But what container would anyone suggest I use for this? Or should I just use an Object[] or Vector ??
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a subclass of Collection, thus, you can change your mind afterwards. an array is very strict and difficult to add new items to it, if you don't know it's size up front.
whether you need a Map or a Set or a List is up to you to decide. You should know how you want to access the components. (but, as I said, with Collection you would encapsulate that decision)
Chantal
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Chantal.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!