• 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

Awt and Swing

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can someone suggest me what's the differnce B/W

setLayout() in AWT

ann Obj.setLayout()=getContentpane(); in Swing
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might get a better response in the forum devoted to Swing/AWT. I'm going to move this thread over there.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've never seen this in Swing
Obj.setLayout()=getContentpane();

setLayout is a setter, requiring a LayoutManager as its argument
getContentPane is a getter that returns an awt.Container
 
Ranch Hand
Posts: 694
Mac OS X Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A LayoutManager object helps a Container object position and size its Component objects.

Each Container has a default LayoutManager object. You can change the default LayoutManager object to a LayoutManager object of a class of your own choosing with a call to setLayout().

The method: setLayout() takes a LayoutManager object as its parameter or takes null for a manual layout in which case you have to position and size the Component objects yourself.

The statement:

f.setLayout(aLayoutManager);

sets the LayoutManager object of a JFrame, assuming that f is an instance of JFrame. The statement:

f.getContentPane().setLayout(anotherLayoutManager);

sets the LayoutManager object of the content pane of the JFrame.

Sometimes when you call a method of a Window, it is implied that you're really working on the content pane. Maybe, somebody can help me to understand this.

Kaydell
reply
    Bookmark Topic Watch Topic
  • New Topic