org.japura.modal
Class Modal

java.lang.Object
  extended by org.japura.modal.Modal

public class Modal
extends java.lang.Object

Modal for frames and dialogs.

Adds a component as modal to the JFrame.

Each JFrame may have more than one component as modal, but only one component can be visible at once.

Copyright (C) 2009-2010 Carlos Eduardo Leite de Andrade

This library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see www.gnu.org/licenses/

For more information, contact: www.japura.org

Author:
Carlos Eduardo Leite de Andrade

Method Summary
static void addListener(javax.swing.JDialog dialog, java.awt.Component component, ModalListener listener)
           
static void addListener(javax.swing.JFrame frame, java.awt.Component component, ModalListener listener)
           
static void addListener(javax.swing.JInternalFrame frame, java.awt.Component component, ModalListener listener)
           
static void addModal(javax.swing.JDialog dialog, java.awt.Component component)
          Add a modal component in the dialog.
static void addModal(javax.swing.JDialog dialog, java.awt.Component component, ModalListener listener)
          Add a modal component in the dialog.
static void addModal(javax.swing.JDialog dialog, java.awt.Component component, ModalListener listener, java.lang.Integer modalDepth)
          Add a modal component in the dialog.
static void addModal(javax.swing.JFrame frame, java.awt.Component component)
          Add a modal component in the frame.
static void addModal(javax.swing.JFrame frame, java.awt.Component component, ModalListener listener)
          Add a modal component in the frame.
static void addModal(javax.swing.JFrame frame, java.awt.Component component, ModalListener listener, java.lang.Integer modalDepth)
          Add a modal component in the frame.
static void addModal(javax.swing.JInternalFrame frame, java.awt.Component component)
          Add a modal component in the internal frame.
static void addModal(javax.swing.JInternalFrame frame, java.awt.Component component, ModalListener listener)
          Add a modal component in the internal frame.
static void addModal(javax.swing.JInternalFrame frame, java.awt.Component component, ModalListener listener, java.lang.Integer modalDepth)
          Add a modal component in the internal frame.
static void closeAllModals(javax.swing.JDialog dialog)
          Close all modals of a specific dialog.
static void closeAllModals(javax.swing.JFrame frame)
          Close all modals of a specific frame.
static void closeAllModals(javax.swing.JInternalFrame frame)
          Close all modals of a specific internal frame.
static void closeCurrentModal(javax.swing.JDialog dialog)
          Close the current modal component of a specific dialog.
static void closeCurrentModal(javax.swing.JFrame frame)
          Close the current modal component of a specific frame.
static void closeCurrentModal(javax.swing.JInternalFrame frame)
          Close the current modal component of a specific internal frame.
static void closeModal(java.awt.Component component)
          Close a specific modal component.
static java.awt.Component getCurrentModal(javax.swing.JDialog dialog)
          Get the current modal component of a specific dialog.
static java.awt.Component getCurrentModal(javax.swing.JFrame frame)
          Get the current modal component of a specific frame.
static java.awt.Component getCurrentModal(javax.swing.JInternalFrame frame)
          Get the current modal component of a specific internal frame.
static int getModalCount(javax.swing.JDialog dialog)
          Get the modal count of a specific dialog.
static int getModalCount(javax.swing.JFrame frame)
          Get the modal count of a specific frame.
static int getModalCount(javax.swing.JInternalFrame frame)
          Get the modal count of a specific internal frame.
static boolean hasModal(javax.swing.JDialog dialog)
          Indicates whether the dialog has a modal.
static boolean hasModal(javax.swing.JFrame frame)
          Indicates whether the frame has a modal.
static boolean hasModal(javax.swing.JInternalFrame frame)
          Indicates whether the internal frame has a modal.
static boolean isModal(java.awt.Component component)
          Indicates whether the component is a modal component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCurrentModal

public static java.awt.Component getCurrentModal(javax.swing.JFrame frame)
Get the current modal component of a specific frame.

Parameters:
frame - the frame with a modal
Returns:
Component

getCurrentModal

public static java.awt.Component getCurrentModal(javax.swing.JDialog dialog)
Get the current modal component of a specific dialog.

Parameters:
dialog - the dialog with a modal
Returns:
Component

getCurrentModal

public static java.awt.Component getCurrentModal(javax.swing.JInternalFrame frame)
Get the current modal component of a specific internal frame.

Parameters:
frame - the internal frame with a modal
Returns:
Component

closeCurrentModal

public static void closeCurrentModal(javax.swing.JFrame frame)
Close the current modal component of a specific frame.

Parameters:
frame - the frame with a modal

closeCurrentModal

public static void closeCurrentModal(javax.swing.JDialog dialog)
Close the current modal component of a specific dialog.

Parameters:
dialog - the dialog with a modal

closeCurrentModal

public static void closeCurrentModal(javax.swing.JInternalFrame frame)
Close the current modal component of a specific internal frame.

Parameters:
frame - the internal frame with a modal

closeModal

public static void closeModal(java.awt.Component component)
Close a specific modal component.

Parameters:
component - the modal's component

closeAllModals

public static void closeAllModals(javax.swing.JFrame frame)
Close all modals of a specific frame.

Parameters:
frame - the frame with a modal

closeAllModals

public static void closeAllModals(javax.swing.JDialog dialog)
Close all modals of a specific dialog.

Parameters:
dialog - the dialog with a modal

closeAllModals

public static void closeAllModals(javax.swing.JInternalFrame frame)
Close all modals of a specific internal frame.

Parameters:
frame - the internal frame with a modal

hasModal

public static boolean hasModal(javax.swing.JFrame frame)
Indicates whether the frame has a modal.

Parameters:
frame - the frame with a modal
Returns:
boolean

hasModal

public static boolean hasModal(javax.swing.JDialog dialog)
Indicates whether the dialog has a modal.

Parameters:
dialog - the dialog with a modal
Returns:
boolean

hasModal

public static boolean hasModal(javax.swing.JInternalFrame frame)
Indicates whether the internal frame has a modal.

Parameters:
frame - the internal frame with a modal
Returns:
boolean

isModal

public static boolean isModal(java.awt.Component component)
Indicates whether the component is a modal component.

Parameters:
component - the component
Returns:
boolean

addModal

public static void addModal(javax.swing.JInternalFrame frame,
                            java.awt.Component component)
Add a modal component in the internal frame.

Parameters:
frame - the internal frame
component - the component for modal

addModal

public static void addModal(javax.swing.JInternalFrame frame,
                            java.awt.Component component,
                            ModalListener listener)
Add a modal component in the internal frame.

Parameters:
frame - the internal frame
component - the component for modal
listener - the listener for modal

addModal

public static void addModal(javax.swing.JInternalFrame frame,
                            java.awt.Component component,
                            ModalListener listener,
                            java.lang.Integer modalDepth)
Add a modal component in the internal frame.

Parameters:
frame - the internal frame
component - the component for modal
listener - the listener for modal
modalDepth - the depth for modal

addModal

public static void addModal(javax.swing.JDialog dialog,
                            java.awt.Component component)
Add a modal component in the dialog.

Parameters:
dialog - the dialog
component - the component for modal

addModal

public static void addModal(javax.swing.JDialog dialog,
                            java.awt.Component component,
                            ModalListener listener)
Add a modal component in the dialog.

Parameters:
dialog - the dialog
component - the component for modal
listener - the listener for modal

addModal

public static void addModal(javax.swing.JDialog dialog,
                            java.awt.Component component,
                            ModalListener listener,
                            java.lang.Integer modalDepth)
Add a modal component in the dialog.

Parameters:
dialog - the dialog
component - the component for modal
listener - the listener for modal
modalDepth - the depth for modal

addModal

public static void addModal(javax.swing.JFrame frame,
                            java.awt.Component component)
Add a modal component in the frame.

Parameters:
frame - the frame
component - the component for modal

addModal

public static void addModal(javax.swing.JFrame frame,
                            java.awt.Component component,
                            ModalListener listener)
Add a modal component in the frame.

Parameters:
frame - the frame
component - the component for modal
listener - the listener for modal

addModal

public static void addModal(javax.swing.JFrame frame,
                            java.awt.Component component,
                            ModalListener listener,
                            java.lang.Integer modalDepth)
Add a modal component in the frame.

Parameters:
frame - the frame
component - the component for modal
listener - the listener for modal
modalDepth - the depth for modal

addListener

public static void addListener(javax.swing.JFrame frame,
                               java.awt.Component component,
                               ModalListener listener)

addListener

public static void addListener(javax.swing.JDialog dialog,
                               java.awt.Component component,
                               ModalListener listener)

addListener

public static void addListener(javax.swing.JInternalFrame frame,
                               java.awt.Component component,
                               ModalListener listener)

getModalCount

public static int getModalCount(javax.swing.JFrame frame)
Get the modal count of a specific frame.

Parameters:
frame - the frame with a modal
Returns:
int

getModalCount

public static int getModalCount(javax.swing.JDialog dialog)
Get the modal count of a specific dialog.

Parameters:
dialog - the dialog with a modal
Returns:
int

getModalCount

public static int getModalCount(javax.swing.JInternalFrame frame)
Get the modal count of a specific internal frame.

Parameters:
frame - the internal frame with a modal
Returns:
int