Java JFrame
How To Create a JFrame?
JFrame ( ) :- This Function helps in creating a frame which is invisible
JFrame ( String Title ) :- This Function Helps in Creating a frame with Title.
JFrame ( GraphicsConfiguration gc ) :- create a Frame with black Title and The Graphics Configuration of Screen.
Class Declaration
Following is the declaration of java.awt.frame class.
public class Frame
extends Frame
implements windowsConstants, Accessible, RootPlaneContainer
Field
JTabel are the fields for java.awt.Component class −
protected AccessibleContext accessibleContext −The accessible context property.
static int EXIT_ON_CLOSE − The exit application default window close operation.
protected JRootPane rootPane − The JRootPane instance that manages the contentPane and optional menuBar for this frame, as well as the glassPane.
protected boolean rootPaneCheckingEnabled − If true then calls to add and setLayout will be forwarded to the contentPane.
Class Constructors
Methods Inherited
JFrame Example:
Useful Methods
Method | Description | Modifier and Type |
---|---|---|
addImpl(Component comp, Object constraints, int index) | Adds the specified child Component. | protected void |
frameInit() | Called by the constructors to init the JFrame properly. | protected void |
setDefaultLookAndFeelDecorated(boolean defaultLookAndFeelDecorated) | Provides a hint as to whether or not newly created JFrames should have their Window decorations (such as borders, widgets to close the window, title...) provided by the current look and feel. | static void |
createRootPane() | Called by the constructor methods to create the default rootPane. | protected JRootPane |
setContentPane(Containe contentPane) | It sets the contentPane property | void |
setIconImage(Image image) | It sets the image to be displayed as the icon for this window. | void |
setJMenuBar(JMenuBar menubar) | It sets the menubar for this frame. | void |
setLayeredPane(JLayeredPane layeredPane) | It sets the layeredPane property. | void |
getRootPane() | It returns the rootPane object for this frame. | JRootPane |
getTransferHandler() | It gets the transferHandler property. | TransferHandler |