Java Graphical User Interface Javax.swing Package (iv) Container, JComponent, JApplet

Source: Internet
Author: User

Class Container

The interfaces implemented are ImageObserver, Menucontainer, Serializable

Known direct subclasses Basicsplitpanedivider, Cellrendererpane, Defaulttreecelleditor.editorcontainer, JComponent, Panel, ScrollPane , Window

Inherit component

The class is in the java.awt package.

The Generic Abstract Window Toolkit (AWT) Container object is a component that can contain other AWT components.

The components that are added to the container are tracked in the list. The order of the lists defines the pre-and post-stack order of the components within the container. If the index is not specified when the component is added to the container, it is added to the end of the list (so it is added to the bottom of the stacking order).

Method

Public Container ()

Constructs a new container. The container can be scaled directly, but in this case it is lightweight and must contain a parent at a higher location in the native unit tree. (for example, frame).

Class JComponent

The interfaces implemented are ImageObserver, Menucontainer, serializable three

Known direct subclasses AbstractButton, Basicinternalframetitlepane, Box, Box.filler, JColorChooser, JComboBox, JFileChooser, JIntern Alframe, Jinternalframe.jdesktopicon, JLabel, Jlayer, JLayeredPane, JList, JMenuBar, Joptionpane, JPanel, JPOPUPM ENU, JProgressBar, JRootPane, Jscrollbar, JScrollPane, Jseparator, JSlider, JSpinner, JSplitPane, JTabbedPane, J Table, Jtableheader, JTextComponent, JToolBar, JToolTip, JTree, JViewport

Inheriting the Container class

base class for all swing components except the top-level container. To use JComponent inherited from JComponent , you must place the component in its root as the top-level swing container in the containment hierarchy. The top swing container-for example JFrame , JDialog and JApplet -is to provide a place where other swing components draw their own dedicated components. For instructions on restricting hierarchies, see the Swing components and the Containment hierarchy section in Java Tutorial .

JComponentThe course offers:

    • base class for standard and custom components that use the swing schema.
    • The pluggable appearance (L&F) specified by the programmer, or (optionally) selected by the user at run time. The look and feel of each component is provided by the UI representative -one from ComponentUI the downloaded object. See how to Set the look and feel in the Java Tutorial for more information.
    • Integrated key handling. View the documentation how to use Key Bindings, in the Java Tutorials article, for more information.
    • Support ToolTips-a short description that pops up when the cursor rests on the component. See how to use Tool tips for more information in the Java tutorial .
    • Support Accessibility. JComponentcontains all the method Accessible interfaces, but it does not actually implement the interface. This is an extension JComponent of individual courses JComponent .
    • Support for component-specific properties. Using the putClientProperty(java.lang.Object, java.lang.Object) and getClientProperty(java.lang.Object) methods, you can make a name object pair with JComponent any object that falls from it JComponent .
    • Painting infrastructure, including double buffering and support boundaries. For more information, see Painting and how to use Borders, both of which are part of the Java tutorial .

For more information about these topics, see the Swing package description and Java Tutorials section of the JComponent Class.

JComponentAnd its subclasses record the default values for some properties. For example, JTable the default row height is 16. Each JComponent subclass has the ComponentUI creation ComponentUI as ComponentUI part of its construction. In order to provide a special look and feel, each ComponentUI can be set back to JComponent create it JComponent . For example, a custom skin might require JTable a row height of 24. The default value of a record is the ComponentUI value of the property before the installation. If you need a specific value for a particular property, you should explicitly set it.

Class JApplet

Interfaces implemented are ImageObserver, Menucontainer, Serializable, Accessible, Rootpanecontainer

Inheriting applet classes

Method

Public JApplet () throws Headlessexception

Create a Swing applet instance.

This constructor returns the value of the component's Zone property JComponent.getDefaultLocale .

Java Graphical User Interface Javax.swing Package (iv) Container, JComponent, JApplet

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.