- Containers method in java
- Uses of Container in java.applet
- Uses of Container in java.awt
- Uses of Container in java.awt.event
- Uses of Container in java.beans.beancontext
- Uses of Container in javax.swing
- Uses of Container in javax.swing.colorchooser
- Uses of Container in javax.swing.event
- Uses of Container in javax.swing.plaf.basic
- Uses of Container in javax.swing.plaf.metal
- Uses of Container in javax.swing.plaf.synth
- Uses of Container in javax.swing.table
- Uses of Container in javax.swing.text
- Uses of Container in javax.swing.tree
- Container Classes in java
- Container Methods in Java:
Containers method in java
Provides the classes necessary to create an applet and the classes an applet uses to communicate with its applet context.
Provides a set of «lightweight» (all-Java language) components that, to the maximum degree possible, work the same on all platforms.
Provides user interface objects built according to the Java look and feel (once codenamed Metal), which is the default look and feel.
Uses of Container in java.applet
An applet is a small program that is intended not to be run on its own, but rather to be embedded inside another application.
Uses of Container in java.awt
A Dialog is a top-level window with a title and a border that is typically used to take some form of input from the user.
A container class which implements automatic horizontal and/or vertical scrolling for a single child component.
Returns the current focus cycle root, if the current focus cycle root is in the same context as the calling thread.
Always returns null because Windows have no ancestors; they represent the top of the Component hierarchy.
Returns the current focus cycle root, even if the calling thread is in a different context than the current focus cycle root.
Give native peers the ability to query the native container given a native component (eg the direct parent may be lightweight).
This method is obsolete and supplied for backwards compatibility only; new code should call arrangeGrid instead.
Returns the component that corresponds to the given constraint location based on the target Container ‘s component orientation.
This method is obsolete and supplied for backwards compatibility only; new code should call getLayoutInfo instead.
This method is obsolete and supplied for backwards compatibility only; new code should call getMinSize instead.
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
Returns whether the specified Container is the focus cycle root of this Component’s focus traversal cycle.
Returns whether the specified Container is the focus cycle root of this Container’s focus traversal cycle.
Returns the maximum dimensions for this layout given the components in the specified target container.
Returns the maximum dimensions for this layout given the components in the specified target container.
Returns the maximum dimensions for this layout given the components in the specified target container.
Calculates the maximum size dimensions for the specified container, given the components it contains.
Returns the minimum dimensions needed to layout the visible components contained in the specified target container.
Calculates the minimum size dimensions for the specified container, given the components it contains.
Returns the preferred dimensions for this layout given the visible components in the specified target container.
Determines the preferred size of the target container using this layout manager, based on the components in the container.
Calculates the preferred size dimensions for the specified container, given the components it contains.
Flips to the component that was added to this layout with the specified name , using addLayoutComponent .
Uses of Container in java.awt.event
Uses of Container in java.beans.beancontext
Uses of Container in javax.swing
An extended version of java.applet.Applet that adds support for the JFC/Swing component architecture.
An implementation of a check box — an item that can be selected or deselected, and which displays its state to the user.
JFormattedTextField extends JTextField adding support for formatting arbitrary values, as well as retrieving a particular object once the user has edited the text.
A lightweight object that provides many of the features of a native frame, including dragging, closing, becoming an icon, resizing, title display, and support for a menu bar.
JLayer is a universal decorator for Swing components which enables you to implement various advanced painting effects as well as receive notifications of all AWTEvent s generated within its borders.
JLayeredPane adds depth to a JFC/Swing container, allowing components to overlap each other when needed.
An implementation of a menu — a popup window containing JMenuItem s that is displayed when the user selects an item on the JMenuBar .
JOptionPane makes it easy to pop up a standard dialog box that prompts users for a value or informs them of something.
JPasswordField is a lightweight component that allows the editing of a single line of text where the view indicates something was typed, but does not show the original characters.
An implementation of a radio button — an item that can be selected or deselected, and which displays its state to the user.
A lightweight container used behind the scenes by JFrame , JDialog , JWindow , JApplet , and JInternalFrame .
JSeparator provides a general purpose component for implementing divider lines — most commonly used as a divider between menu items that breaks them up into logical groupings.
A component that lets the user graphically select a value by sliding a knob within a bounded interval.
A single line input field that lets the user select a number or an object value from an ordered sequence.
A simple base class for more specialized editors that displays a read-only view of the model’s current value with a JFormattedTextField .
A component that lets the user switch between a group of components by clicking on a tab with a given title and/or icon.
Convenience method for searching above comp in the component hierarchy and returns the first object of name it finds.
Convenience method for searching above comp in the component hierarchy and returns the first object of class c it finds.
Returns the top-level ancestor of this component (either the containing Window or Applet ), or null if this component has not been added to any container.
Indicates a child has changed its layout related information, which causes any cached calculations to be flushed.
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
Indicates that a child has changed its layout related information, and thus any cached calculations should be flushed.
Returns the maximum dimensions needed to lay out the components contained in the specified target container.
Returns the minimum dimensions needed to lay out the components contained in the specified target container.
The minimum size of a ScrollPane is the size of the insets plus minimum size of the viewport, plus the scrollpane’s viewportBorder insets, plus the minimum size of the visible headers, plus the minimum size of the scrollbars whose displayPolicy isn’t NEVER.
Returns the minimum dimensions needed to layout the components contained in the specified target container.
Returns the minimum dimensions needed to lay out the components contained in the specified target container.
Returns the preferred dimensions for this layout given the components in the specified target container.
The preferred size of a ScrollPane is the size of the insets, plus the preferred size of the viewport, plus the preferred size of the visible headers, plus the preferred size of the scrollbars that will appear given the current view and the current scrollbar displayPolicies.
Returns the preferred dimensions for this layout given the components in the specified target container.
Returns the preferred dimensions for this layout, given the components in the specified target container.
Uses of Container in javax.swing.colorchooser
Uses of Container in javax.swing.event
Uses of Container in javax.swing.plaf.basic
Creates the appropriate object to represent each of the objects in buttons and adds it to container .
Uses of Container in javax.swing.plaf.metal
Uses of Container in javax.swing.plaf.synth
Called from SynthOptionPaneUI.installComponents() to create a Container containing the body of the message.
Uses of Container in javax.swing.table
Uses of Container in javax.swing.text
Uses of Container in javax.swing.tree
Container Classes in java
All container classes, therefore, have many of the same methods. We would like to list some frequently used methods here so that we don’t have to explain them again in my upcoming articles but can focus on the differences there.
Container Methods in Java:
method name | short description |
add | There are different variants of the add method. The simple add method is used to add a component to the container. However, there are still various add methods (such as addKeyListener ) that can be used to assign a specific EventListener to the container. In this way, certain user actions (e.g. keystrokes) can be recognized and treated accordingly. |
setSize | The width and height of the container can be set using the setSize method. |
setVisible | With setVisible you can control the visibility of any control element or container class. |
getComponent | The method getComponent is available in different variants. These serve to receive components located in the container and to be able to address them in this way. For example, the container located at the transferred position can be determined via getComponentAt. The getComponents method returns an array with all components in the respective container. |
setLayout | A so-called layout manager can be set using the setLayout method. This controls the display of the individual elements. Layouts are explained in more detail in a separate article. |
remove | The remove method also comes in different flavors. This does exactly the opposite of add, ie elements or EventListeners added to the container can be removed with remove. |
Listing all methods would go beyond the scope. See the Java API for this.