artofillusion.ui
Class UIUtilities

java.lang.Object
  extended by artofillusion.ui.UIUtilities

public class UIUtilities
extends java.lang.Object

This class provides a variety of static methods for performing useful UI related operations.


Constructor Summary
UIUtilities()
           
 
Method Summary
static void applyBackground(Widget w, java.awt.Color color)
          Set up a Widget and all of its children to have a specific background color.
static void applyDefaultBackground(Widget w)
          Set up a Widget and all of its children to have the default background and text colors for the program.
static void applyDefaultFont(Widget w)
          Set up a Widget and all of its children to have the default font for the program.
static void applyTextColor(Widget w, java.awt.Color color)
          Set up a Widget and all of its children to have a specific text color.
static java.lang.String[] breakString(java.lang.String s)
          Break a string into lines which are short enough to easily display in a window.
static void centerDialog(BDialog dlg, WindowWidget parent)
          Given a BDialog, center it relative to a parent window.
static void centerWindow(WindowWidget win)
          Given a WindowWidget, center it in the screen.
static WidgetContainer createScrollingList(BList list)
          Given an BList, create an appropriate container for it.
static java.util.List<Widget> findAllChildren(Widget w)
          Find every Widget which is contained within a specified one, either as a direct child or through multiple levels of nesting.
static BFrame findFrame(Widget w)
          Given a Widget, find its parent BFrame.
static WindowWidget findWindow(Widget w)
          Given a Widget, find the window that contains it.
static void fitWindowToScreen(WindowWidget win)
          Ensure that a WindowWidget fits entirely on the screen, making it smaller if necessary.
static java.awt.Font getDefaultFont()
          Get the default font for the program (may be null).
static int getStandardDialogInsets()
          Get the insets which should be used on all dialogs.
static void setDefaultFont(java.awt.Font font)
          Set the default font for the program (may be null).
static void setEnabled(Widget w, boolean enabled)
          Recursively enable or disable a container and everything inside it.
static void setStandardDialogInsets(int pixels)
          Set the insets which should be used on all dialogs.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UIUtilities

public UIUtilities()
Method Detail

centerWindow

public static void centerWindow(WindowWidget win)
Given a WindowWidget, center it in the screen.


centerDialog

public static void centerDialog(BDialog dlg,
                                WindowWidget parent)
Given a BDialog, center it relative to a parent window.


fitWindowToScreen

public static void fitWindowToScreen(WindowWidget win)
Ensure that a WindowWidget fits entirely on the screen, making it smaller if necessary.


getDefaultFont

public static java.awt.Font getDefaultFont()
Get the default font for the program (may be null).


setDefaultFont

public static void setDefaultFont(java.awt.Font font)
Set the default font for the program (may be null).


getStandardDialogInsets

public static int getStandardDialogInsets()
Get the insets which should be used on all dialogs.


setStandardDialogInsets

public static void setStandardDialogInsets(int pixels)
Set the insets which should be used on all dialogs.


applyDefaultFont

public static void applyDefaultFont(Widget w)
Set up a Widget and all of its children to have the default font for the program.


applyDefaultBackground

public static void applyDefaultBackground(Widget w)
Set up a Widget and all of its children to have the default background and text colors for the program.


applyBackground

public static void applyBackground(Widget w,
                                   java.awt.Color color)
Set up a Widget and all of its children to have a specific background color.


applyTextColor

public static void applyTextColor(Widget w,
                                  java.awt.Color color)
Set up a Widget and all of its children to have a specific text color.


createScrollingList

public static WidgetContainer createScrollingList(BList list)
Given an BList, create an appropriate container for it. This involves a properly configured BScrollPane, with an outline around it.


findWindow

public static WindowWidget findWindow(Widget w)
Given a Widget, find the window that contains it. If the Widget is not in a window, return null.


findFrame

public static BFrame findFrame(Widget w)
Given a Widget, find its parent BFrame. If the Widget is inside a BFrame, that frame will be returned. If it is inside a BDialog, this returns the dialog's parent frame. Otherwise, this returns null.


breakString

public static java.lang.String[] breakString(java.lang.String s)
Break a string into lines which are short enough to easily display in a window.


setEnabled

public static void setEnabled(Widget w,
                              boolean enabled)
Recursively enable or disable a container and everything inside it.


findAllChildren

public static java.util.List<Widget> findAllChildren(Widget w)
Find every Widget which is contained within a specified one, either as a direct child or through multiple levels of nesting.



Copyright © 1999-2011 by Peter Eastman.