Class ContainerNesting


  • public class ContainerNesting
    extends Object
    Generates a tree structure from a Swing container.

    A class name can be provided on the command-line. The provided class requires a default constructor in order to be analyzed.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • ContainerNesting

        public ContainerNesting()
    • Method Detail

      • getLabel

        protected static String getLabel​(Component comp)
        Generates the label for the component.
        Parameters:
        comp - the component to generate a label for
        Returns:
        the label
      • analyze

        protected static BaseTreeNode analyze​(BaseTreeNode parent,
                                              Component comp)
        Analyzes the given Swing container.
        Parameters:
        parent - the parent in the tree, use null for root
        comp - the component to analyze
        Returns:
        the parent
      • analyze

        public static BaseTree analyze​(Container cont)
        Analyzes the given Swing container.
        Parameters:
        cont - the container to analyze
        Returns:
        the generated tree of the nested elements
      • main

        public static void main​(String[] args)
                         throws Exception
        Analyzes the class defined by its classname as second parameter. The first parameter is the environment class, e.g., adams.env.Environment.
        Parameters:
        args - the command-line parameters (environment class + container class)
        Throws:
        Exception