Java javax.swing JFrame fields, constructors, methods, implement or subclass

Example usage for Java javax.swing JFrame fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for javax.swing JFrame.

The text is from its open source code.

Subclass

javax.swing.JFrame has subclasses.
Click this link to see all its subclasses.

Constructor

JFrame(GraphicsConfiguration gc)
Creates a Frame in the specified GraphicsConfiguration of a screen device and a blank title.
JFrame(String title)
Creates a new, initially invisible Frame with the specified title.
JFrame()
Constructs a new frame that is initially invisible.

Method

Componentadd(Component comp)
Appends the specified component to the end of this container.
Componentadd(String name, Component comp)
Adds the specified component to this container.
voidaddComponentListener(ComponentListener l)
Adds the specified component listener to receive component events from this component.
voidaddContainerListener(ContainerListener l)
Adds the specified container listener to receive container events from this container.
voidaddKeyListener(KeyListener l)
Adds the specified key listener to receive key events from this component.
voidaddMouseListener(MouseListener l)
Adds the specified mouse listener to receive mouse events from this component.
voidaddMouseMotionListener(MouseMotionListener l)
Adds the specified mouse motion listener to receive mouse motion events from this component.
voidaddWindowListener(WindowListener l)
Adds the specified window listener to receive window events from this window.
voidaddWindowStateListener(WindowStateListener l)
Adds the specified window state listener to receive window events from this window.
voidapplyComponentOrientation(ComponentOrientation o)
Sets the ComponentOrientation property of this container and all components contained within it.
voidcreateBufferStrategy(int numBuffers)
Creates a new strategy for multi-buffering on this component.
voiddispatchEvent(AWTEvent e)
Dispatches an event to this component or one of its sub components.
voiddispose()
Releases all of the native screen resources used by this Window , its subcomponents, and all of its owned children.
ComponentfindComponentAt(Point p)
Locates the visible child component that contains the specified point.
RectanglegetBounds()
Gets the bounds of this component in the form of a Rectangle object.
ComponentgetComponent(int n)
Gets the nth component in this container.
intgetComponentCount()
Gets the number of components in this panel.
Component[]getComponents()
Gets all the components in this container.
ContainergetContentPane()
Returns the contentPane object for this frame.
intgetDefaultCloseOperation()
Returns the operation that occurs when the user initiates a "close" on this frame.
intgetExtendedState()
Gets the state of this frame.
SetgetFocusTraversalKeys(int id)
Gets a focus traversal key for this Window.
FontgetFont()
Gets the font of this component.
FontMetricsgetFontMetrics(Font font)
Gets the font metrics for the specified font.
ComponentgetGlassPane()
Returns the glassPane object for this frame.
GraphicsgetGraphics()
GraphicsConfigurationgetGraphicsConfiguration()
Gets the GraphicsConfiguration associated with this Component .
intgetHeight()
Returns the current height of this component.
ImagegetIconImage()
Returns the image to be displayed as the icon for this frame.
InsetsgetInsets()
Determines the insets of this container, which indicate the size of the container's border.
JMenuBargetJMenuBar()
Returns the menubar set on this frame.
JLayeredPanegetLayeredPane()
Returns the layeredPane object for this frame.
LocalegetLocale()
Gets the Locale object that is associated with this window, if the locale has been set.
PointgetLocation()
Gets the location of this component in the form of a point specifying the component's top-left corner.
PointgetLocationOnScreen()
Gets the location of this component in the form of a point specifying the component's top-left corner in the screen's coordinate space.
DimensiongetMaximumSize()
Returns the maximum size of this container.
DimensiongetMinimumSize()
Returns the minimum size of this container.
ComponentgetMostRecentFocusOwner()
Returns the child Component of this Window that will receive the focus when this Window is focused.
StringgetName()
Gets the name of the component.
ContainergetParent()
Gets the parent of this component.
DimensiongetPreferredSize()
Returns the preferred size of this container.
JRootPanegetRootPane()
Returns the rootPane object for this frame.
DimensiongetSize()
Returns the size of this component in the form of a Dimension object.
intgetState()
Gets the state of this frame (obsolete).
StringgetTitle()
Gets the title of the frame.
ToolkitgetToolkit()
Returns the toolkit of this frame.
intgetWidth()
Returns the current width of this component.
WindowListener[]getWindowListeners()
Returns an array of all the window listeners registered on this window.
intgetX()
Returns the current x coordinate of the components origin.
intgetY()
Returns the current y coordinate of the components origin.
booleanisActive()
Returns whether this Window is active.
booleanisAlwaysOnTop()
Returns whether this window is an always-on-top window.
booleanisAlwaysOnTopSupported()
Returns whether the always-on-top mode is supported for this window.
booleanisDisplayable()
Determines whether this component is displayable.
booleanisFocused()
Returns whether this Window is focused.
booleanisFocusOwner()
Returns true if this Component is the focus owner.
booleanisResizable()
Indicates whether this frame is resizable by the user.
booleanisShowing()
Checks if this Window is showing on screen.
booleanisVisible()
Determines whether this component should be visible when its parent is visible.
voidpack()
Causes this Window to be sized to fit the preferred size and layouts of its subcomponents.
voidprint(Graphics g)
Prints the container.
voidremoveWindowListener(WindowListener l)
Removes the specified window listener so that it no longer receives window events from this window.
voidrepaint()
Repaints this component.
voidrequestFocus()
Requests that this Component get the input focus, and that this Component's top-level ancestor become the focused Window.
voidrevalidate()
Revalidates the component hierarchy up to the nearest validate root.
voidsetAlwaysOnTop(boolean alwaysOnTop)
Sets whether this window should always be above other windows.
voidsetBackground(Color bgColor)
voidsetBounds(int x, int y, int width, int height)

The width or height values are automatically enlarged if either is less than the minimum size as specified by previous call to setMinimumSize .

voidsetBounds(Rectangle r)

The r.width or r.height values will be automatically enlarged if either is less than the minimum size as specified by previous call to setMinimumSize .

voidsetComponentOrientation(ComponentOrientation o)
Sets the language-sensitive orientation that is to be used to order the elements or text within this component.
voidsetContentPane(Container contentPane)
Sets the contentPane property.
voidsetCursor(int cursorType)
Sets the cursor for this frame to the specified type.
voidsetDefaultCloseOperation(int operation)
Sets the operation that will happen by default when the user initiates a "close" on this frame.
voidsetDefaultLookAndFeelDecorated(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.
voidsetEnabled(boolean b)
Enables or disables this component, depending on the value of the parameter b .
voidsetExtendedState(int state)
Sets the state of this frame.
voidsetFocusable(boolean focusable)
Sets the focusable state of this Component to the specified value.
voidsetFocusableWindowState(boolean focusableWindowState)
Sets whether this Window can become the focused Window if it meets the other requirements outlined in isFocusableWindow .
voidsetFocusTraversalKeys(int id, Set keystrokes)
Sets the focus traversal keys for a given traversal operation for this Container.
voidsetFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled)
Sets whether focus traversal keys are enabled for this Component.
voidsetFocusTraversalPolicy(FocusTraversalPolicy policy)
Sets the focus traversal policy that will manage keyboard traversal of this Container's children, if this Container is a focus cycle root.
voidsetForeground(Color c)
Sets the foreground color of this component.
voidsetGlassPane(Component glassPane)
Sets the glassPane property.
voidsetIconImage(Image image)
voidsetIconImages(java.util.List icons)
Sets the sequence of images to be displayed as the icon for this window.
voidsetIgnoreRepaint(boolean ignoreRepaint)
Sets whether or not paint messages received from the operating system should be ignored.
voidsetJMenuBar(final JMenuBar menubar)
Sets the menubar for this frame.
voidsetLayout(LayoutManager manager)
Sets the LayoutManager.
voidsetLocale(Locale l)
Sets the locale of this component.
voidsetLocation(int x, int y)

The method changes the geometry-related data.

voidsetLocation(Point p)

The method changes the geometry-related data.

voidsetLocationByPlatform(boolean locationByPlatform)
Sets whether this Window should appear at the default location for the native windowing system or at the current location (returned by getLocation ) the next time the Window is made visible.
voidsetLocationRelativeTo(Component c)
Sets the location of the window relative to the specified component according to the following scenarios.
voidsetMaximizedBounds(Rectangle bounds)
Sets the maximized bounds for this frame.
voidsetMaximumSize(Dimension maximumSize)
Sets the maximum size of this component to a constant value.
voidsetMinimumSize(Dimension minimumSize)
Sets the minimum size of this window to a constant value.
voidsetModalExclusionType(Dialog.ModalExclusionType exclusionType)
Specifies the modal exclusion type for this window.
voidsetName(String name)
Sets the name of the component to the specified string.
voidsetPreferredSize(Dimension preferredSize)
Sets the preferred size of this component to a constant value.
voidsetResizable(boolean resizable)
Sets whether this frame is resizable by the user.
voidsetSize(int width, int height)

The width and height values are automatically enlarged if either is less than the minimum size as specified by previous call to setMinimumSize .

voidsetSize(Dimension d)

The d.width and d.height values are automatically enlarged if either is less than the minimum size as specified by previous call to setMinimumSize .

voidsetState(int state)
Sets the state of this frame (obsolete).
voidsetTitle(String title)
Sets the title for this frame to the specified string.
voidsetUndecorated(boolean undecorated)
Disables or enables decorations for this frame.
voidsetVisible(boolean b)
Shows or hides this Window depending on the value of parameter b .
voidshow()
Makes the Window visible.
voidtoBack()
If this Window is visible, sends this Window to the back and may cause it to lose focus or activation if it is the focused or active Window.
voidtoFront()
If this Window is visible, brings this Window to the front and may make it the focused Window.
voidvalidate()
Validates this container and all of its subcomponents.