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
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
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.
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); }
Bookmarks