|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
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 |
#2
| |||
| |||
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. |
#3
| |||
| |||
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); } |
![]() |
|
Tags: getcontentpane method, java programming, programming language |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Method overriding versus method hiding in C# | ^MALARVIZHI^ | Software Development | 4 | 25-12-2010 06:25 AM |
What are JFC and Swing? | DANIEL 602 | Software Development | 5 | 14-02-2010 04:11 AM |
Is it possible to call destroy() method within init() Method? | Level8 | Software Development | 3 | 10-12-2009 08:36 AM |
What is method overriding and method overloading in java | beelow | Software Development | 3 | 17-11-2009 08:20 AM |
Java: How can I call one method in another method? | biohazard 76 | Software Development | 3 | 16-07-2009 07:12 PM |