I'm sorry, maybe it's simple, but I can't explain this. There is following code(swing):
public class Sandbox2 extends Frame implements ActionListener {
JTextField tf; JLabel l; JButton b;
Sandbox2() {
tf=new JTextField();
...
//there is what i can`t understand
add(b);add(tf);add(l);
setSize(400,400);
setLayout(null);
setVisible(true);
}
public void actionPerformed(ActionEvent e) {
...
}
public static void main(String[] args) {
new Sandbox2();
}
}
Firstly I create a button, text field and others, after that I add it to a frame. But how it works if all methods, add(), setSize()... were called without frame instance?
I understand that it due with a Frame inheritance, but how?