JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.util.swing
Class JCRectUtil

java.lang.Object
  |
  +--com.klg.jclass.util.swing.JCRectUtil

public class JCRectUtil
extends Object

JCRectUtil provides functions for computing the largest available rectangle from a list of rectangles.
Here is a brief summary of how to use it:

  1. Initialize with a rectangle by calling rlInit(r, v), where r is the initializing rectangle and v is a blank vector.
  2. Call rlRemove(r, v1, v2) to remove sub-rectangle r from the rectangles in the Vector of rectangles v1, placing the new list of rectangles in Vector v2. Repeat as necessary.
  3. Call largestRect(v) to return the largest available rectangle from the passed-inVector of rectangles.


Field Summary
static int LEFTTORIGHT
           
static int TOPTOBOTTOM
           
 
Constructor Summary
JCRectUtil()
           
 
Method Summary
static Rectangle largestRect(Vector rl)
          Determines the largest rectangle in the space represented by a list of non-overlapping rectangles.
static void rlInit(Rectangle r, Vector rl)
          Initializes this rectangle list.
static void rlRemove(Rectangle r, Vector rl1, Vector rl2)
          Removes rectangle r from rectlist rl1, storing the result in rl2.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFTTORIGHT

public static final int LEFTTORIGHT
See Also:
Constant Field Values

TOPTOBOTTOM

public static final int TOPTOBOTTOM
See Also:
Constant Field Values
Constructor Detail

JCRectUtil

public JCRectUtil()
Method Detail

rlInit

public static void rlInit(Rectangle r,
                          Vector rl)
Initializes this rectangle list.

Parameters:
r - rectangle to intialize this list with
rl - rectangle list, a vector, to initialize
Since:
JClass 4.0K for Java 2. If you are using JClass 4.0J, which is based on JDK 1.1, this method's parameter must be a com.sun.java.util.collections.Vector.

rlRemove

public static void rlRemove(Rectangle r,
                            Vector rl1,
                            Vector rl2)
Removes rectangle r from rectlist rl1, storing the result in rl2.

Parameters:
r - rectangle to remove
rl1 - rectangle list, a vector, to remove rectangle from
rl2 - rectangle list, a vector, to place result in

largestRect

public static Rectangle largestRect(Vector rl)
Determines the largest rectangle in the space represented by a list of non-overlapping rectangles.

Parameters:
rl - the list of rectangles, in vector form, to use for the calculation
Returns:
the largest rectangle in the list

Copyright © 2004 Quest Software Inc..
All rights reserved.