Class SwingHelper


  • public class SwingHelper
    extends Object
    Helper class providing some utilities for Swing programming.
    • Constructor Detail

      • SwingHelper

        public SwingHelper()
    • Method Detail

      • centerComponent

        public static void centerComponent​(Component comp,
                                           Component alignComp)
        Centers the given component over another component.

        The method performs the alignment by setting a newly computed location for the component. It does not alter the component's size.

        Parameters:
        comp - the component whose location is to be altered
        alignComp - the component used for the alignment of the first component, if null the component is ceneterd within the screen area
        Throws:
        IllegalArgumentException - if the component is null