title: Add/remove JFXPanel on Swing JFrame
body: <p>I want to add and remove <code>JFXPanel</code> on <code>JFrame</code> container but not able to do that. I am stuck here and get no proper solution on button click I want to add and remove the <code>JFXPanel</code>  control. </p>
  
  <p>What is the wrong in this code?</p>
  
  <pre><code>  public class abc extends JFrame
    {
    JFXPanel fxpanel;
    Container cp;
    public abc()
    {
    cp=this.getContentPane();
    cp.setLayout(null);
    JButton b1= new JButton("Ok");
    JButton b2= new JButton("hide");
    cp.add(b1);
    cp.add(b2);
    b1.setBounds(20,50,50,50);
    b2.setBounds(70,50,50,50);
    b1.addActionListener(this);
    b2.addActionListener(this);
    fxpanel= new JFXPanel();
    cp.add(fxpanel);
    fxpanel.setBounds(600,200,400,500);
   }
  
    public void actionPerformed(ActionEvent ae)
   { 
   if(ae.getActionCommand().equals("OK"))
    {
      fxpanel= new JFXPanel();
      cp.add(fxpanel);
      fxpanel.setBounds(600,200,400,500);
  
  
     }
    if(ae.getActionCommand().equals("hide"))
     { 
      cp.remove(fxpanel);
      }
     }
      public static void main(String args[])
     {
  
        abc f1= new abc();
        f1.show();
      }
     }
  </code></pre>