title: Where to place JOptionPaneShowInputDialog code?
body: <p>Where to place JOptionPaneShowInputDialog code?
  Where to place JOptionPaneShowInputDialog code?Where to place JOptionPaneShowInputDialog code?
  Where to place JOptionPaneShowInputDialog code?
  Where to place JOptionPaneShowInputDialog code?
  I would like to add a JoptionPaneShowInputDialog()(not in code yet) inside the code herebelow. </p>
  
  <p>I can do, but I cannot make the dialog appearing in the black panel,before the recursion.</p>
  
  <p>The dialog appears after the drawing...                                                  </p>
  
  <pre><code>public class FractalTree extends JPanel implements ActionListener
       {
  
        int x1=350;  
        int y1=600;
        int angle=-90;
        int depth=11;          
        int k=10;
  
        JLabel label_1;
  
        private void drawTree(Graphics g, int x1, int y1, double angle, int depth, int k)
           {
            if(depth==11)
  
            g.setColor(Color.GRAY);
            g.fillRect(100, 600, 1160, 10);
            g.setColor(Color.white);
            if (depth == 0) return;
  
            ((Graphics2D) g).setStroke(new BasicStroke((float) (k*0.9)));
            int x2 = x1 + (int) (Math.cos(Math.toRadians(angle)) * depth * 11*Math.random()+1);
            int y2 = y1 + (int) (Math.sin(Math.toRadians(angle)) * depth * 11*Math.random()+1);
            if(depth&lt;3)
             {
               g.setColor(Color.green);
             }
  
            g.drawLine(x1, y1, x2, y2);
            drawTree(g, x2, y2, angle - 19, depth-1,k-1);
            drawTree(g, x2, y2, angle + 19, depth-1,k-1);
  
           }
  
  
      public void paintComponent(Graphics g)
       {       
              super.paintComponent(g);
              g.setColor(Color.white);
  
              drawTree(g,x1,y1,angle,depth,k);
              drawTree(g,x1+600,y1,angle,depth,k);    
       }
  
  
      public FractalTree()
       {      
         this.setBackground(Color.black);  
       }
  
      public static void gui()
            {
             JFrame f=new JFrame("fractal tree");
             JLabel label_1=new JLabel("&lt;html&gt;RANDOM TREE&lt;br&gt;&lt;center&gt;FRACTAL");
             label_1.setForeground(Color.red);
             Font font = new Font("Courier", Font.BOLD,25);
             label_1.setFont(font);
             FractalTree ft=new FractalTree();
             f.getContentPane().add(ft);
             f.setSize(1500, 1000);
             JButton button = new JButton("Close Me");
             button.addActionListener(ft);    
             f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);         
             ft.add(label_1);
             ft.add(button);
             f.setUndecorated(true);
             f.setVisible(true);
            }
  
      public static void main(String[] args)
          {               
          gui();      
          }
      @Override
      public void actionPerformed(ActionEvent e)
          {
          System.exit(0);     
          }
  }
  </code></pre>
  
  <p>May I ask some help?
  Thanks                                         </p>