Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
    Bookmark Topic Watch Topic
  • New Topic

JFrame doubt  RSS feed

 
thanvi janu
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • 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.

Thanks in advance
 
Rob Camick
Ranch Hand
Posts: 2787
12
  • Mark post as helpful
  • send pies
  • Report post to moderator
Quit multi posting. You asked this question a couple of hours ago and I told you why you don't get any help.
 
Rob Spoor
Sheriff
Posts: 21044
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
Rob Camick wrote:Quit multi posting. You asked this question a couple of hours ago and I told you why you don't get any help.

Indeed. Let's continue here.
 
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!