New Modal dialog box API parsing in Java 6

Source: Internet
Author: User

First, the introduction

dialog box, which is a top-level pop-up window with a title and a border, is typically applied to a user for some form of input operation. In JDK 5.0 and earlier versions, when building a dialog box, it must have a frame window or another dialog box as its owner window, even if the window is not visible. This dialog box is automatically hidden when the user minimizes the owner window of a visible dialog box, and the dialog box appears again when the user then restores the owner window.

A dialog box can be modeless or modal. In addition to the window of the owner of the dialog box, the modal dialog box blocks input from other top-level windows in the application. The modal dialog box captures the window focus until it is closed (often in response to a button click). On the other hand, a modeless dialog box allows the user to change its state, while other windows can still have the focus. The latter is commonly used in toolbar windows, such as what you see in an image editing program.

Modal models in JDK 5.0 and earlier versions have some limitations. Moreover, there are some problems in this modal model. The most famous issue involves the Javahelp tool window. Javahelp,java an API that provides help information in an application, using a separate window to display all the necessary information. However, if the application displays any modal dialog boxes, such as a standard Save As dialog box, the dialog box prevents users from interacting with the Javahelp tool window.

But Java 6, the code name Mustang, has solved this and several other problems with a new abstract window Toolbox (AWT) modal model. This new model allows the developer to specify a range or limit the modal block of a dialog box based on its chosen modal type. Such modal types also allow Windows and dialogs to become true without parent windows, and that is, to have a null parent window that can help limit the window's scope and the modal of the dialog box.

Type of modal

Java 6 supports four modal types:

No mode. Modeless dialog boxes do not block any other windows when they are visible.

Document-mode. The document-modal dialog box blocks all windows from the same document, except those from the windows on its child level. In this sense, a document refers to a window hierarchy-frame windows, dialog boxes, and so on-that share a document root window. The document root window is the top-level window for all without an owner.

Application-mode. The application-modal dialog box can block all windows in the same application except those from the windows on its child level. If you activate several applets in your browser, browsers will use them as stand-alone applications or as a single application. Specific circumstances depend on the specific circumstances of the implementation.

Toolbox-mode. The Toolbox-modal dialog box blocks all windows running in the same toolbox, except for those that come from a window on its child level. If you activate multiple applets, they all run on the same toolbox. Therefore, the Toolbox-modal dialog box displayed from the applet may affect other applets.

As with the previous JDK, a dialog box is modeless by default. But if you construct a modal dialog box in Mustang, it will now use the application-pattern type by default. In addition, the behavior of patterns and modeless dialogs has changed in Mustang, and they can always appear at the top of their parent window.

Modal priority is determined by the blocking strength. This modal priority helps to handle situations where two dialog boxes are visible and can block each other. Priority is in ascending order: modeless, document-mode, application-schema, and toolbox-mode. This priority naturally reflects a nested case in which the scope of a dialog box is blocked. A modeless dialog box has an empty range of interrupts. The scope blocking of the document-modal dialog box is done in a particular application, and all applications run in a toolbox. Figure 1 shows an example of this.

Figure 1: Modal Precedence for dialog boxes

Note that this new modal model does not implement a system mode, which will block (Java or other) all applications that are displayed on the desktop, and only one modal dialog box is active.

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.