• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JCheckBox[ ]

 
Jesse Walker
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to create an array of JCheckboxes called check, I can declare it fine but how do you intialize the checkboxes with different strings??
Thanks,
Jesse
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As with any array of object types, when you initialize the array you just make a number of empty slots. (Or Cups if you read the recommended campfire stories.)

You haven't made any checkboxes yet. You'll need to create some and put them into the array:

Then you can see whichones are checked

Does that makes sense?
 
Jesse Walker
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that explains alot, I was also wondering if there is a way to initialize and declare in the same statement?
 
John Bartlett
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Do you mean doing something like this:



John
[ December 13, 2006: Message edited by: John Bartlett ]
 
Jesse Walker
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that is exactly what I was looking for. One more question, other then the paint and repaint methods is there a way to refresh a frame using an Action Event to add components?
Thank you,
Jesse
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jesse Walker:
Yes, that is exactly what I was looking for. One more question, other then the paint and repaint methods is there a way to refresh a frame using an Action Event to add components?
Thank you,
Jesse


It probably would be a good idea to start a new thread in the Swing forum for this question.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic