public class FormLayoutComparator extends Object implements Comparator<Component>, Serializable
FormFocusTraversalPolicy.
Necessary because javax.swing.LayoutComparator is package final.
| Constructor and Description |
|---|
FormLayoutComparator()
Creates a comparator with default values.
|
FormLayoutComparator(int tolerance,
boolean horizontal,
boolean leftToRight)
Creates a comparator for components.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compare(Component o1,
Component o2) |
int |
getTolerance()
Gets the row/column tolerance.
|
boolean |
isHorizontal()
Gets the horizontal traversal flag.
|
boolean |
isLeftToRight()
Gets the left-to-right traversal flag.
|
void |
setComponentOrientation(ComponentOrientation orientation)
Sets the component orientation of this comparator.
|
void |
setHorizontal(boolean horizontal)
Sets the horizontal traversal flag.
|
void |
setLeftToRight(boolean leftToRight)
Sets the left-to-right traversal flag.
|
void |
setTolerance(int tolerance)
Sets the row/column tolerance.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcomparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongpublic FormLayoutComparator(int tolerance,
boolean horizontal,
boolean leftToRight)
tolerance - the tolerance in pixels to detect components belonging to the same row or columnhorizontal - true if focus traversal is horizontalleftToRight - true if focus traversal is left to rightpublic FormLayoutComparator()
rowTolerance = 10 horizontal = true leftToRight = true
public void setComponentOrientation(ComponentOrientation orientation)
orientation - the orientation (usually from a container)public boolean isHorizontal()
public void setHorizontal(boolean horizontal)
horizontal - true if traversal is horizontalpublic boolean isLeftToRight()
public void setLeftToRight(boolean leftToRight)
leftToRight - true if traversal is left to rightpublic int getTolerance()
public void setTolerance(int tolerance)
tolerance - the tolerancepublic int compare(Component o1, Component o2)
Code mostly copied from javax.swing.LayoutComparator
compare in interface Comparator<Component>Tentackle - distributed, domain- and model-driven