Create components and put them in the frame.įrame.getContentPane().add(emptyLabel, BorderLayout.CENTER) Optional: What happens when the frame closes?įtDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) The following FrameDemo code shows how to create and set up a frame. Here is a picture of the extremely plain window created by the FrameDemo demonstration application. To make a window that appears within another window, use an internal frame. To make a window that is dependent on another window disappearing when the other window is iconified, for example use a dialog instead of frame. Applications with a GUI usually include at least one frame. JFrame class, is a window that has decorations such as a border, a title, and supports button components that close or iconify the window. Since the border area is included in the overall size of the frame, the border effectively obscures a portion of the frame, constraining the area available for rendering and/or displaying subcomponents to the rectangle which has an upper-left corner location of (insets.left, insets.top), and has a size of width - (insets.left + insets.right) by height - (insets.top + insets.bottom).Ī frame, implemented as an instance of the The dimensions of the border area may be obtained using the getInsets method. The size of the frame includes any area designated for the border. A Frame is a top-level window with a title and a border.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |