title: IntelliJ idea gui designer + maven
body: <p>I have a project created with help of GUI designer. 
  Here is code of main form.</p>
  
  <pre><code>public class MainForm {
      MainForm() {
          directLineOkButton.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent arg0) {
                 //some action
                  }
              }
          });
          crossLineOkButton.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent arg0) {
                 //some action
          });
          clearButton.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent arg0) {
              //some action
          });
          cancelButton.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent arg0) {
              //some action
          });
          saveButton.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent arg0) {
            //some action
          });
      }
  
      public JPanel getMainPanel() {
          return mainPanel;
      }
  
      private void createUIComponents() {
          drawingPanel = new DrawingPanel();
      }
  
      private JPanel mainPanel;
      private JComboBox directDirectionCombobox;
      private JButton directLineOkButton;
      private JButton crossLineOkButton;
      private JComboBox crossLineComboBox;
      private JTextField crossLineSizeValue;
      private JButton clearButton;
      private JLabel directLineLabel;
      private JPanel directLinePanel;
      private JLabel crossLineLabel;
      private JPanel crossLinePanel;
      private JPanel okClearButtonPanel;
      private JTextField directLineSizeValue;
      private JButton saveButton;
      private JPanel drawingPanel;
      private JButton cancelButton;
  }
  </code></pre>
  
  <p>It works fine. Jar file generates fine, here code of pom.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;DOC&lt;/groupId&gt;
      &lt;artifactId&gt;DOC&lt;/artifactId&gt;
      &lt;version&gt;1.0&lt;/version&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.poi&lt;/groupId&gt;
              &lt;artifactId&gt;poi&lt;/artifactId&gt;
              &lt;version&gt;3.9&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.3.2&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.6&lt;/source&gt;
                      &lt;target&gt;1.6&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
  
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;archive&gt;
                          &lt;manifest&gt;
                              &lt;addClasspath&gt;true&lt;/addClasspath&gt;
                              &lt;mainClass&gt;Main&lt;/mainClass&gt;
                          &lt;/manifest&gt;
                      &lt;/archive&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
  
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;archive&gt;
                          &lt;manifest&gt;
                              &lt;mainClass&gt;Main&lt;/mainClass&gt;
                          &lt;/manifest&gt;
                      &lt;/archive&gt;
                      &lt;descriptorRefs&gt;
                          &lt;descriptorRef&gt;jar-with-dependencies&lt;/descriptorRef&gt;
                      &lt;/descriptorRefs&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>But when I try to run jar file there is a mistake.</p>
  
  <pre><code>Exception in thread "main" java.lang.NullPointerException
  at MainForm.&lt;init&gt;(MainForm.java:14)
  at Main.main(Main.java:13)
  </code></pre>
  
  <p>It show that mistake is at the line where directLineOkButton listener is created. I create listener like said here: 
  <a href="http://www.jetbrains.com/idea/training/demos/GUI_Designer/GUI_Designer.html">http://www.jetbrains.com/idea/training/demos/GUI_Designer/GUI_Designer.html</a>
  in constructor using cmd+o.
  Here is code of xml of form:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="MainForm"&gt;
    &lt;grid id="27dc6" binding="mainPanel" layout-manager="FormLayout"&gt;
      &lt;rowspec value="center:23px:noGrow"/&gt;
      &lt;rowspec value="top:3dlu:noGrow"/&gt;
      &lt;rowspec value="center:47px:noGrow"/&gt;
      &lt;rowspec value="top:3dlu:noGrow"/&gt;
      &lt;rowspec value="center:max(d;4px):noGrow"/&gt;
      &lt;rowspec value="top:3dlu:noGrow"/&gt;
      &lt;rowspec value="center:max(d;4px):noGrow"/&gt;
      &lt;rowspec value="top:7dlu:noGrow"/&gt;
      &lt;rowspec value="center:25px:noGrow"/&gt;
      &lt;rowspec value="top:174dlu:noGrow"/&gt;
      &lt;rowspec value="center:max(d;4px):noGrow"/&gt;
      &lt;colspec value="fill:d:noGrow"/&gt;
      &lt;colspec value="left:4dlu:noGrow"/&gt;
      &lt;colspec value="fill:452px:noGrow"/&gt;
      &lt;constraints&gt;
        &lt;xy x="20" y="20" width="797" height="453"/&gt;
      &lt;/constraints&gt;
      &lt;properties/&gt;
      &lt;border type="none"/&gt;
      &lt;children&gt;
        &lt;component id="3b663" class="javax.swing.JLabel" binding="directLineLabel"&gt;
          &lt;constraints&gt;
            &lt;grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/&gt;
            &lt;forms/&gt;
          &lt;/constraints&gt;
          &lt;properties&gt;
            &lt;text value="Direct Line"/&gt;
          &lt;/properties&gt;
        &lt;/component&gt;
        &lt;grid id="499e0" binding="directLinePanel" layout-manager="FormLayout"&gt;
          &lt;rowspec value="center:d:grow"/&gt;
          &lt;colspec value="fill:98px:noGrow"/&gt;
          &lt;colspec value="left:4dlu:noGrow"/&gt;
          &lt;colspec value="fill:80px:grow"/&gt;
          &lt;colspec value="left:4dlu:noGrow"/&gt;
          &lt;colspec value="fill:max(d;4px):noGrow"/&gt;
          &lt;colspec value="left:4dlu:noGrow"/&gt;
          &lt;colspec value="fill:max(d;4px):noGrow"/&gt;
          &lt;constraints&gt;
            &lt;grid row="1" column="0" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/&gt;
            &lt;forms/&gt;
          &lt;/constraints&gt;
          &lt;properties/&gt;
          &lt;border type="none"/&gt;
          &lt;children&gt;
            &lt;component id="c383d" class="javax.swing.JComboBox" binding="directDirectionCombobox"&gt;
              &lt;constraints&gt;
                &lt;grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/&gt;
                &lt;forms/&gt;
              &lt;/constraints&gt;
              &lt;properties&gt;
                &lt;enabled value="true"/&gt;
                &lt;model&gt;
                  &lt;item value="Вверх"/&gt;
                  &lt;item value="Вниз"/&gt;
                  &lt;item value="Вправо"/&gt;
                  &lt;item value="Влево"/&gt;
                &lt;/model&gt;
              &lt;/properties&gt;
            &lt;/component&gt;
            &lt;component id="17aa1" class="javax.swing.JTextField" binding="directLineSizeValue"&gt;
              &lt;constraints&gt;
                &lt;grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"&gt;
                  &lt;preferred-size width="150" height="-1"/&gt;
                &lt;/grid&gt;
                &lt;forms defaultalign-horz="false"/&gt;
              &lt;/constraints&gt;
              &lt;properties/&gt;
            &lt;/component&gt;
            &lt;component id="44fc7" class="javax.swing.JButton" binding="directLineOkButton"&gt;
              &lt;constraints&gt;
                &lt;grid row="0" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/&gt;
                &lt;forms/&gt;
              &lt;/constraints&gt;
              &lt;properties&gt;
                &lt;text value="OK"/&gt;
              &lt;/properties&gt;
            &lt;/component&gt;
          &lt;/children&gt;
        &lt;/grid&gt;
        &lt;component id="5a571" class="javax.swing.JLabel" binding="crossLineLabel"&gt;
          &lt;constraints&gt;
            &lt;grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/&gt;
            &lt;forms/&gt;
          &lt;/constraints&gt;
          &lt;properties&gt;
            &lt;text value="Cross Line"/&gt;
          &lt;/properties&gt;
        &lt;/component&gt;
        &lt;grid id="77f1a" binding="crossLinePanel" layout-manager="FormLayout"&gt;
          &lt;rowspec value="center:d:grow"/&gt;
          &lt;colspec value="fill:98px:noGrow"/&gt;
          &lt;colspec value="left:4dlu:noGrow"/&gt;
          &lt;colspec value="fill:80px:grow"/&gt;
          &lt;colspec value="left:4dlu:noGrow"/&gt;
          &lt;colspec value="fill:max(d;4px):noGrow"/&gt;
          &lt;colspec value="left:4dlu:noGrow"/&gt;
          &lt;colspec value="fill:max(d;4px):noGrow"/&gt;
          &lt;constraints&gt;
            &lt;grid row="6" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/&gt;
            &lt;forms/&gt;
          &lt;/constraints&gt;
          &lt;properties/&gt;
          &lt;border type="none"/&gt;
          &lt;children&gt;
            &lt;component id="32368" class="javax.swing.JComboBox" binding="crossLineComboBox"&gt;
              &lt;constraints&gt;
                &lt;grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/&gt;
                &lt;forms/&gt;
              &lt;/constraints&gt;
              &lt;properties&gt;
                &lt;model&gt;
                  &lt;item value="Вверх-вправо"/&gt;
                  &lt;item value="Вверх-влево"/&gt;
                  &lt;item value="Вниз-вправо"/&gt;
                  &lt;item value="Вниз-влево"/&gt;
                &lt;/model&gt;
              &lt;/properties&gt;
            &lt;/component&gt;
            &lt;component id="dbf23" class="javax.swing.JTextField" binding="crossLineSizeValue"&gt;
              &lt;constraints&gt;
                &lt;grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"&gt;
                  &lt;preferred-size width="150" height="-1"/&gt;
                &lt;/grid&gt;
                &lt;forms defaultalign-horz="false"/&gt;
              &lt;/constraints&gt;
              &lt;properties/&gt;
            &lt;/component&gt;
            &lt;component id="c5c8a" class="javax.swing.JButton" binding="crossLineOkButton"&gt;
              &lt;constraints&gt;
                &lt;grid row="0" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/&gt;
                &lt;forms/&gt;
              &lt;/constraints&gt;
              &lt;properties&gt;
                &lt;text value="OK"/&gt;
              &lt;/properties&gt;
            &lt;/component&gt;
          &lt;/children&gt;
        &lt;/grid&gt;
        &lt;grid id="53bbc" binding="okClearButtonPanel" layout-manager="FormLayout"&gt;
          &lt;rowspec value="center:d:noGrow"/&gt;
          &lt;colspec value="fill:d:noGrow"/&gt;
          &lt;colspec value="left:4dlu:noGrow"/&gt;
          &lt;colspec value="fill:max(d;4px):noGrow"/&gt;
          &lt;colspec value="left:4dlu:noGrow"/&gt;
          &lt;colspec value="fill:max(d;4px):noGrow"/&gt;
          &lt;constraints&gt;
            &lt;grid row="8" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/&gt;
            &lt;forms/&gt;
          &lt;/constraints&gt;
          &lt;properties&gt;
            &lt;enabled value="false"/&gt;
          &lt;/properties&gt;
          &lt;border type="none"/&gt;
          &lt;children&gt;
            &lt;component id="41ba7" class="javax.swing.JButton" binding="saveButton"&gt;
              &lt;constraints&gt;
                &lt;grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/&gt;
                &lt;forms/&gt;
              &lt;/constraints&gt;
              &lt;properties&gt;
                &lt;text value="Сохранить"/&gt;
              &lt;/properties&gt;
            &lt;/component&gt;
            &lt;component id="a6bf6" class="javax.swing.JButton" binding="clearButton"&gt;
              &lt;constraints&gt;
                &lt;grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/&gt;
                &lt;forms/&gt;
              &lt;/constraints&gt;
              &lt;properties&gt;
                &lt;text value="Очистить"/&gt;
              &lt;/properties&gt;
            &lt;/component&gt;
            &lt;component id="40f1c" class="javax.swing.JButton" binding="cancelButton"&gt;
              &lt;constraints&gt;
                &lt;grid row="0" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/&gt;
                &lt;forms/&gt;
              &lt;/constraints&gt;
              &lt;properties&gt;
                &lt;text value="Отменить"/&gt;
              &lt;/properties&gt;
            &lt;/component&gt;
          &lt;/children&gt;
        &lt;/grid&gt;
        &lt;grid id="2e94e" binding="drawingPanel" custom-create="true" layout-manager="FormLayout"&gt;
          &lt;rowspec value="center:d:grow"/&gt;
          &lt;colspec value="fill:d:grow"/&gt;
          &lt;constraints&gt;
            &lt;grid row="0" column="2" row-span="11" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/&gt;
            &lt;forms/&gt;
          &lt;/constraints&gt;
          &lt;properties&gt;
            &lt;background color="-1"/&gt;
          &lt;/properties&gt;
          &lt;border type="none"/&gt;
          &lt;children/&gt;
        &lt;/grid&gt;
      &lt;/children&gt;
    &lt;/grid&gt;
  &lt;/form&gt;
  </code></pre>