Action objects action interface objects provide a

This preview shows page 197 - 201 out of 235 pages.

Action Objects: action interface objects provide a single point of control for program actions. An example of this would be a toolbar icon and a menu item referencing the
same Action objects. When action object disabled, the GUI items that reference it are automatically disabled. Virtual Desktops: The JdesktopPane and JInternalFrame classes can be used to create a virtual desktop or multiple document interface. A JInternalFrame can be specified as cognizable, expandable or closable, while the JDesktopPane Provides real estate for them to operate in. Pluggable look and feel: The user can select a look and feel and this can be plugged in. An interface made of Swing components can look like a Win32 app, a Motif app. It can use the new Metal look and feel. Wide variety of components: Class names that starts with J are the components that are added to and application. For ex. JButton, JList, JPanel. 13.4 JComponent The JComponent class is the root of the visual component class hierarchy in the JFC. The visual components are known as the ―J‖ classes. The functionality contained in the JComponent class is available to all the visual components contained in the JFC. The JComponent class is repository of functionality for all visual components. The JComponent class is at the top of the hierarchy of all visual components contained in the JFC. The hierarchy is shown in the following figure.
13.5 JApplet The JApplet class is an extended version of the AWT applet class that adds support for root panes and other panes.. This class is the preferred entry point when creating applets that contain JFC components. The components are added to the ContentPane. The constructor that can be used to create a JApplet are listed below: JApplet() : It creates a swing applet instance Some of the methods that can be used in conjunction with the JApplet is given below: createRootPane( ): Called by the constructor methods to create the default root pane. getContentPane( ) : Returns the content pane object for the applet getGlassPane( ) : Returns the glass pane object for the applet Window J Window Frame Dialog J Dialog J Frame Applet J Applet JComponent J Color Chooser Abstract Button J File Chooser J Lable J List J Menu Bar J Combo Box J Internal Frame J Menu Item J Button J Toggle Button J Radio Button J Check Box Menu Item J Check Box J Radio Button Menu Item J Menu
getJMenuBar( ) : Returns the menu bar set on the applet setContentPane( ) : sets the content pane properly setGlassPane( ) : sets the glass pane properly setLayout(LayoutManagermanager) : By default the layout of this component may not be set, the layout of its contentPane should be set instead. 13.6 JFrame Frame windows: A frame is a top-level window that contains a title, border, minimize and maximize buttons. JFC provides the JFrame class. This is used as a top-level-frame.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture