public class EmbeddingGenerator {

    public static void main(String[] args) {
        if (args.length != 1) {
            System.err.println("Needs <depth>");
            return ;
        }

        int depth = Integer.parseInt(args[0]);

        System.out.print("package javaapplication11;\n" +
                         "\n" +
                         "import javax.swing.*;\n" +
                         "\n" +
                         "public class Embedding {\n" +
                         "\n" +
                         "    private void test() {\n" +
                         "        GroupLayout l = new GroupLayout(new JPanel());\n" +
                         "        l.setHorizontalGroup(\n");

        gen(depth);
        System.out.print(");\n" +
                         "}\n" +
                         "}\n");
    }

    private static void gen(int depth) {
        System.out.print("l.createParallelGroup()\n");
        if (depth > 0) {
            System.out.print(".addGroup(\n");
            gen(depth - 1);
            System.out.println(")");
        }

        System.out.println(".addGap(1)\n" +
                           ".addComponent(new JLabel(\"\"))\n" +
                           ".addGap(1)\n" +
                           ".addComponent(new JLabel(\"\"))");
    }

}
