permaculture playing cards*
The moose likes Swing / AWT / SWT and the fly likes why Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "why" Watch "why" New topic
Author

why

sae0203
Ranch Hand

Joined: Sep 19, 2002
Posts: 34
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);


SAE <br /> <br /><a href="http://www.findsingapore.net/forum" target="_blank" rel="nofollow">http://www.findsingapore.net/forum</a>
Emil Karlsson
Ranch Hand

Joined: May 23, 2002
Posts: 63
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

Joined: Sep 19, 2002
Posts: 34
mm... so that's why. thanks emil
 
Don't get me started about those stupid light bulbs.
 
subject: why
 
Similar Threads
filewriter not working
filewriter not working
Sample maintenance disply
Java Guessing Game - OutOfMemoryError
help!!!a problem about java gui