• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Doubt in JFrame

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Read this if you want answers to your questions.
 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Camick wrote:Read this if you want answers to your questions.


Indeed!
 
If you are using a rototiller, you are doing it wrong. Even on this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic