Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



How to use getContentPane() method in Swing

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 29-06-2009
Member
 
Join Date: Jun 2009
Posts: 45
How to use getContentPane() method in Swing
  

I am newbie to the JAVA programming language I have requirement to apply getContentPane() method in my program but i have very less information regarding it, so if anyone has any idea or knowledge about it please let me know.

Thanks for your Help

Reply With Quote
  #2  
Old 29-06-2009
Member
 
Join Date: Mar 2008
Posts: 232
Re: How to use getContentPane() method in Swing

The frame / dialog / window itself has other internal components - like the content pane. getContentPane() is a method that returns a container that is where you usually add all of your components instead of adding Component objects directly to a window such as a JFrame or a JDialog.

import java.awt.*;
import java.util.*;
import javax.swing.*;
import javax.swing.JEditorPane;
import javax.swing.JFrame;

To import the above mentioned method you need to import the above functions in your program.
Reply With Quote
  #3  
Old 29-06-2009
Member
 
Join Date: Jan 2009
Posts: 99
Re: How to use getContentPane() method in Swing

The swing top-level containers all have a single root component (JRootPane, see here) which holds several, layered sub-containers (content pane, layered pane, glass pane). getContentPane(): frames are wht make up windows in your UI and these frames are made up from an object which has 3 layers to it which are called: rootpane, contentpane and glasspane from lowest to highest. Generally everything you see in your ui goes into the contentpane. This pane is just a container object which holds everything and this is what your getting from this method. Here you can have the following programming format for getContentPane
Code:
public void add(Component component, Object constraints)  
{  
    getContentPane().add(component, constraints);  
}
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to use getContentPane() method in Swing"
Thread Thread Starter Forum Replies Last Post
Method overriding versus method hiding in C# ^MALARVIZHI^ Software Development 4 25-12-2010 05:25 AM
What are JFC and Swing? DANIEL 602 Software Development 5 14-02-2010 03:11 AM
Is it possible to call destroy() method within init() Method? Level8 Software Development 3 10-12-2009 07:36 AM
What is method overriding and method overloading in java beelow Software Development 3 17-11-2009 07:20 AM
Java: How can I call one method in another method? biohazard 76 Software Development 3 16-07-2009 07:12 PM


All times are GMT +5.5. The time now is 02:56 PM.