Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reusing the same objects in swing

 
Nithya Venkatraman
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I reuse the same object in a swing?
I have this code (given below) and want to use the same lblBlank11 at all places where I have given lblBlankxx? But when i do this the desgin changes totally. Please help


pnlInitiator.setLayout( new GridLayout(7,4) );
pnlInitiator.add(lblBlank11);
pnlInitiator.add(lblBlank12);
pnlInitiator.add(lblBlank13);
pnlInitiator.add(lblBlank14);
pnlInitiator.add(lblName1);
pnlInitiator.add(txtFldName1);
pnlInitiator.add(lblBlank15);
pnlInitiator.add(lblBlank16);
pnlInitiator.add(lblBlank17);
pnlInitiator.add(lblBlank18);
pnlInitiator.add(lblBlank19);
pnlInitiator.add(lblBlank20);
pnlInitiator.add(lblTelNoOff1);
pnlInitiator.add(txtFldTelNoOff1);
pnlInitiator.add(lblBlank3);
pnlInitiator.add(lblBlank4);
pnlInitiator.add(lblBlank21);
pnlInitiator.add(lblBlank22);
pnlInitiator.add(lblBlank23);
pnlInitiator.add(lblBlank24);
pnlInitiator.add(lblRemarksTab1);
pnlInitiator.add(scpRemarks1);
pnlInitiator.add(lblBlank25);
pnlInitiator.add(lblBlank26);
pnlInitiator.add(lblBlank27);
pnlInitiator.add(lblBlank28);
pnlInitiator.add(lblBlank29);
pnlInitiator.add(lblBlank30);
 
Don Kiddick
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, you cannot add the same label to multiple Containers or to the same Container multiple times.

D.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic