Tags:JAVA Questions | 222 views
|
Java JFrame class example JFrameJava Swing Tutorial Explaining the JFrame class. The components added to the frame are referred to as its contents; these are managed by the contentPane. To add a component to a JFrame, we must use its contentPane instead.JFrame is a Window with border, title and buttons. When JFrame is set visible, an event dispatching thread is started. JFrame objects store several objects including a Container object known as the content pane. To add a component to a JFrame, add it to the content pane. JFrame Features It’s a window with title, border, (optional) menu bar and user-specified components. Centering JFrame’s By default, a Jframe is displayed in the upper-left corner of the screen. To display a frame The Swing API keeps improving with abstractions such as the setDefaultCloseOperation method Crating a JFrame Window Step 1: Construct an object of the JFrame class. Step 2: Set the size of the Jframe. Step 3: Set the title of the Jframe to appear in the title bar (title bar will be blank if no title is set). Step 4: Set the default close operation. When the user clicks the close button, the program stops running. Step 5: Make the Jframe visible. How to position JFrame on Screen? frame.setLocationRelativeTo( null ); |
RSS feed for comments on this post · TrackBack URI
Leave a reply