Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How i can dynamically add the child components to jpanel

 
nand rai
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How i can dynamically add the child components to jpanel

I have jpanel

and many lables,text feilds, check boxes, multi select and others.

How can i dynamiclly add all the elements to jpanel.

I want to avoid the following

this.add(jLabelB);
this.add(imageSeqComboBox, null);
this.add(jLabel0, null);
//this.add(txtImageLocator, null);
//this.add(jLabel3, null);
this.add(txtSerialNumber, null);
this.add(jLabel2, null);
this.add(txtAmount, null);
this.add(jLabel11, null);
this.add(txtIssueId, null);
this.add(jLabel1, null);
this.add(txtIssueDate, null);
this.add(jLabel5, null);
this.add(txtRangeBegin, null);
this.add(jLabel9, null);
this.add(txtTotalMO, null);
this.add(jLabel4, null);
//this.add(jLabel81,null);
//this.add(txtFRBProcessDate,null);
this.add(jLabel82,null);
this.add(txtMoOrigin,null);
this.add(jLabel83,null);
//this.add(txt8105A,null);
this.add(formA,null);
this.add(formB,null);
this.add(jLabel84,null);
this.add(txtUserLastName,null);


Thanks
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about putting them in a Component[] and adding each element in a for loop?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic