• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

JCheckBox[ ]  RSS feed

 
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
 
(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?
 
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
 
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!