File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes add() method for components Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "add() method for components" Watch "add() method for components" New topic

add() method for components

Angela Narain
Ranch Hand

Joined: Apr 14, 2001
Posts: 327
Suppose "bt" is an instance of a class that extends Frame.
We set BorderLayout manager.
Now is it possible to a button in the following manner :
Button b = new Button("ok");
bt.add("North", b );
I donot know in which class we have this type of overloaded add method ?
g krishnan

Joined: Mar 30, 2001
Posts: 23
it is the method of container,
public void add(Component comp,
Object constraints)
Object constraints refers the North, South etc, check with API
jayu jadhav

Joined: Apr 13, 2001
Posts: 13
In Container class:
public Component add(string name,component)
I agree. Here's the link:
subject: add() method for components
It's not a secret anymore!