Class ComponentUtil

java.lang.Object
net.infonode.gui.ComponentUtil

public class ComponentUtil extends Object
  • Method Details

    • getChildAt

      public static final Component getChildAt(Container container, Point p)
    • getVisibleChildAt

      public static final Component getVisibleChildAt(Container container, Point p)
    • getChildAtLine

      public static final Component getChildAtLine(Container container, Point p, boolean horizontal)
    • getComponentTreePosition

      public static void getComponentTreePosition(Component c, ArrayList pos)
    • findComponentUnderGlassPaneAt

      public static Component findComponentUnderGlassPaneAt(Point p, Component top)
    • getComponentIndex

      public static final int getComponentIndex(Component component)
    • getBorderLayoutOrientation

      public static final String getBorderLayoutOrientation(Direction d)
    • getBackgroundColor

      public static Color getBackgroundColor(Component component)
    • countComponents

      public static int countComponents(Container c)
    • getVisibleChildrenCount

      public static int getVisibleChildrenCount(Component c)
    • getTopLevelAncestor

      public static Component getTopLevelAncestor(Component c)
    • hasVisibleChildren

      public static boolean hasVisibleChildren(Component c)
    • isOnlyVisibleComponent

      public static boolean isOnlyVisibleComponent(Component c)
    • isOnlyVisibleComponents

      public static boolean isOnlyVisibleComponents(Component[] c)
    • findFirstComponentOfType

      public static Component findFirstComponentOfType(Component comp, Class c)
    • isFocusable

      public static boolean isFocusable(Component c)
    • requestFocus

      public static boolean requestFocus(Component component)
      Requests focus unless the component already has focus. For some weird reason calling Component.requestFocusInWindow()when the component is focus owner changes focus owner to another component!
      Parameters:
      component - the component to request focus for
      Returns:
      true if the component has focus or probably will get focus, otherwise false
    • smartRequestFocus

      public static Component smartRequestFocus(Component component)
      Requests focus for a component. If that's not possible it's FocusTraversalPolicyis checked. If that doesn't work all it's children is recursively checked with this method.
      Parameters:
      component - the component to request focus for
      Returns:
      the component which has focus or probably will obtain focus, null if no component will receive focus
    • getPreferredMaxHeight

      public static int getPreferredMaxHeight(Component[] components)
      Calculates preferred max height for the given components without checking isVisible.
      Parameters:
      components - Components to check
      Returns:
      max height
    • getPreferredMaxWidth

      public static int getPreferredMaxWidth(Component[] components)
      Calculates preferred max width for the given components without checking isVisible.
      Parameters:
      components - Components to check
      Returns:
      max width
    • setAllOpaque

      public static void setAllOpaque(Container c, boolean opaque)
    • validate

      public static void validate(JComponent c)
    • validate

      public static void validate(Component c)