title: setUndecorated(true) to a JDialog created from an instance of JOptionPane
body: <p>I currently have a <code>JDialog</code> created by calling the <code>createDialog()</code> method from my instance of <code>JOptionPane</code>:</p>
  
  <pre><code>JOptionPane pane = new JOptionPane(myPanel, JOptionPane.PLAIN_MESSAGE,JOptionPane.DEFAULT_OPTION, null, new Object[]{}, null);
  dialog = pane.createDialog(null, "");
  </code></pre>
  
  <p>I wanted to be able to remove the title bar from the <code>JDialog</code> by calling <code>setUndecorated(true)</code> onto the <code>JDialog</code>, but I get an <code>IllegalComponentStateException: The dialog is displayable</code> exception when I attempt to run my program. </p>
  
  <p>As far as I know, the dialog is not being displayed before I call <code>dialog.show()</code>, which leads me to believe that the dialog is indeed "displayable" upon instantiating the dialog through <code>pane.createDialog()</code> far beyond my understanding of the <code>JDialog</code> API.</p>
  
  <p>I have attempted to call <code>setVisible(false)</code> prior to using <code>setUndecorated(true)</code>, but to no avail. </p>
  
  <p>Any help would be appreciated as to how or of it is possible at all to remove the title bar of a <code>JDialog</code> of this type. Removing the title bar from a normal <code>JDialog</code> is easy enough, as seen from numerous other answers to questions of this type, but I cannot seem to get it to work for a <code>JDialog</code> created through <code>createDialog()</code>.</p>
  
  <p>Relevant code:</p>
  
  <pre><code>            input= new JTextField(50);
  
          input.addKeyListener(new ConsoleKeyListener());
  
  
          input.addAncestorListener( new RequestFocusListener() );
          field = new JTextArea();
          field.setEditable(false);
          field.setLineWrap(true);
          JScrollPane area = new JScrollPane(field, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
          field.setRows(10);
          field.setText(consoleText);
          JPanel myPanel = new JPanel();
  
          myPanel.setLayout(new BorderLayout(0,0));
          myPanel.add(input, BorderLayout.PAGE_END);
          myPanel.add(area, BorderLayout.PAGE_START);
          input.setFocusable(true);
          input.requestFocus();
          int result = 101;
          //int result = JOptionPane.showOptionDialog(null, myPanel,"", JOptionPane.DEFAULT_OPTION,JOptionPane.PLAIN_MESSAGE, null, new Object[]{}, null);
          JOptionPane pane = new JOptionPane(myPanel, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[]{}, null);
  
          dialog = pane.createDialog(null, "");
          dialog.setVisible(false);
          dialog.setUndecorated(true);
          //dialog.undecorated = true;
  
  
          //dialog.setOpacity(0.55f);
          removeMinMaxClose(dialog);
          removeMinMaxClose(pane); 
          removeMinMaxClose(myPanel);
          dialog.getRootPane().setOpaque(false);
  
          //JDialog dialog = new JDialog();
          //dialog.setVisible(false);
          //dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
          //myPanel.setUndecorated(true);
          //dialog.setUndecorated(true);
          //dialog.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);  
          //dialog.setBounds( 100, 100, 300, 200 );  
          dialog.addWindowListener(new WindowAdapter() {
              public void windowClosing(WindowEvent we) {
                  System.out.println("yo");
              }
          });
          dialog.setVisible(true);
          dialog.show();
  </code></pre>