File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why

 
sae0203
Ranch Hand
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why can't i add this in the container like this?

label1 = new JLabel("Type");
label2 = new JLabel("Product ID");
label3 = new JLabel("Stock Available");
label4 = new JLabel("Quantity Needed");
label5 = new JLabel("Estimated Buy In");
label6 = new JLabel("Needed By");
label7 = new JLabel("Total Cost");

pan5.add(label1, label2, label3, label4, label5, label6, label7);

txt1=new JTextField("",5);
txt2=new JTextField("",5);
txt3=new JTextField("",5);
txt4=new JTextField("",5);
txt5=new JTextField("",5);
txt6=new JTextField("",5);
txt7=new JTextField("",5);

pan4.add(txt1, txt2, txt3, txt4, txt5, txt6, txt7);
 
Emil Karlsson
Ranch Hand
Posts: 63
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, ambrosia
If you take a look att the add() method in Container you wil see that it can only take one component each time you use it.
add(Component comp)
add(Component comp, int index)
add(Component comp, Object constraints)
add(Component comp, Object constraints, int index)
add(String name, Component comp)
But there are some other things that is possible to include.
/Emil
 
sae0203
Ranch Hand
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mm... so that's why. thanks emil
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic