• Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubt in JFrame

 
thanvi janu
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Im new to swing, please clear me this doubt.


import javax.swing.*;
import java.awt.*;
public class reference extends JFrame{
JPanel p1;
JButton b;
reference(){
b=new JButton("Click me");
setLayout(new FlowLayout());
add(b);
setVisible(true);

setSize(500,500);
}

public static void main(String str[])
{
new reference();
}

}


I have just extended JFrame in the code, now when im calling the setLayout(), setVisible(), setSize() without any reference variable.
I want to know which objects setLayout(), setVisible(), setSize() is being invoked. Whether its JFrame or its superclass?

Please correct me if im wrong.
really confused.
 
Rob Camick
Ranch Hand
Posts: 2699
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read this if you want answers to your questions.
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Camick wrote:Read this if you want answers to your questions.

Indeed!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!