chrriis.common
Class UIUtils

java.lang.Object
  extended by chrriis.common.UIUtils

public class UIUtils
extends Object

Author:
Christopher Deckers

Method Summary
static Rectangle getBounds(Rectangle[] rectangles)
          Get the bounds containing all the rectangles.
static Rectangle[] getComponentVisibleArea(Component component, Filter<Component> filter, boolean traverseChildren)
          Get the area that is not covered by components obeying the condition imposed by the visitor.
static void setPreferredLookAndFeel()
           
static Rectangle[] subtract(Rectangle[] rects, Rectangle rect)
          Subtracts the area specified by the rectangle rect from each of the areas specified by the rectangles in rects.
static Rectangle[] subtract(Rectangle[] rects1, Rectangle[] rects2)
          Subtracts the area specified by the rectangles in rects2 from each of the areas specified by the rectangles in rects1.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

subtract

public static Rectangle[] subtract(Rectangle[] rects,
                                   Rectangle rect)
Subtracts the area specified by the rectangle rect from each of the areas specified by the rectangles in rects.

Parameters:
rects - The rectangles to substract from.
rect - The rectangle to substract.
Returns:
an array of rectangles, which may not have the same number of rectangles as in rects.

subtract

public static Rectangle[] subtract(Rectangle[] rects1,
                                   Rectangle[] rects2)
Subtracts the area specified by the rectangles in rects2 from each of the areas specified by the rectangles in rects1.

Parameters:
rects1 - The rectangles to substract from.
rects2 - The rectangles to substract.
Returns:
an array of rectangles, which may not have the same number of rectangles as in rects1.

getComponentVisibleArea

public static Rectangle[] getComponentVisibleArea(Component component,
                                                  Filter<Component> filter,
                                                  boolean traverseChildren)
Get the area that is not covered by components obeying the condition imposed by the visitor. Usually, the filter focuses on all components, or opaque components.

Parameters:
component - the component for which to find the visible areas.
filter - the filter to consider when determining if an area is hidden.
traverseChildren - true if children that are not captured by the filter should look into their own children recursively.
Returns:
an array of rectangles specify the visible area.

getBounds

public static Rectangle getBounds(Rectangle[] rectangles)
Get the bounds containing all the rectangles.

Parameters:
rectangles - the rectangles to get the bounds for.
Returns:
a rectangle that contains all the rectangles, potentially an empty rectangle.

setPreferredLookAndFeel

public static void setPreferredLookAndFeel()