com.mucommander.ui.dialog
Class DialogToolkit

java.lang.Object
  extended by com.mucommander.ui.dialog.DialogToolkit

public class DialogToolkit
extends java.lang.Object

Placeholder for convenience methods that ease dialog creation.

Author:
Maxence Bernard

Constructor Summary
DialogToolkit()
           
 
Method Summary
static void centerOnScreen(java.awt.Component c)
          Sets the given component's (JFrame, JDialog...) location to be centered on screen.
static void centerOnWindow(java.awt.Component c, java.awt.Window window)
          Centers the specified component on the specified window.
static javax.swing.JPanel createButtonPanel(javax.swing.JButton[] buttons, javax.swing.JRootPane rootPane, java.awt.event.ActionListener actionListener)
          Creates a button panel using the given buttons, and register the given listener for button actions.
static javax.swing.JPanel createOKCancelPanel(javax.swing.JButton okButton, javax.swing.JButton cancelButton, javax.swing.JRootPane rootPane, java.awt.event.ActionListener actionListener)
          Creates an OK/Cancel panel using the given buttons, and register the given listener for button actions.
static javax.swing.JPanel createOKPanel(javax.swing.JButton okButton, javax.swing.JRootPane rootPane, java.awt.event.ActionListener actionListener)
          Creates an OK panel using the given button, and register the given listener for button actions.
static boolean fitToMaxDimension(java.awt.Window window, java.awt.Dimension maxD)
           
static boolean fitToMinDimension(java.awt.Window window, java.awt.Dimension minD)
           
static boolean fitToScreen(java.awt.Window window)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DialogToolkit

public DialogToolkit()
Method Detail

fitToMinDimension

public static boolean fitToMinDimension(java.awt.Window window,
                                        java.awt.Dimension minD)

fitToMaxDimension

public static boolean fitToMaxDimension(java.awt.Window window,
                                        java.awt.Dimension maxD)

fitToScreen

public static boolean fitToScreen(java.awt.Window window)

centerOnScreen

public static void centerOnScreen(java.awt.Component c)
Sets the given component's (JFrame, JDialog...) location to be centered on screen.


centerOnWindow

public static void centerOnWindow(java.awt.Component c,
                                  java.awt.Window window)
Centers the specified component on the specified window.

Note that this method assumes c's dimension to be at most that of the screen. This can be ensured through fitToScreen(Window). If this constraint is not respected, behaviour is unpredictable.

Parameters:
c - component to center.
window - window to center on.

createOKCancelPanel

public static javax.swing.JPanel createOKCancelPanel(javax.swing.JButton okButton,
                                                     javax.swing.JButton cancelButton,
                                                     javax.swing.JRootPane rootPane,
                                                     java.awt.event.ActionListener actionListener)
Creates an OK/Cancel panel using the given buttons, and register the given listener for button actions.


createOKPanel

public static javax.swing.JPanel createOKPanel(javax.swing.JButton okButton,
                                               javax.swing.JRootPane rootPane,
                                               java.awt.event.ActionListener actionListener)
Creates an OK panel using the given button, and register the given listener for button actions.


createButtonPanel

public static javax.swing.JPanel createButtonPanel(javax.swing.JButton[] buttons,
                                                   javax.swing.JRootPane rootPane,
                                                   java.awt.event.ActionListener actionListener)
Creates a button panel using the given buttons, and register the given listener for button actions. Buttons are disposed horizontally, aligned to the right.



This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard