title: Hide and display JFXPanel on Swing JFrame
body: <p>I want to hide and show FXPanel controls in javaFx application in swing</p>
  
  <p>I want on clicking a button FXPanel control should be hidden and on clicking other the control should be again visible it is being hidden not being visible again.</p>
  
  <p>using the following 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.setVisible(true);
   }
     if(ae.getActionCommand().equals("hide"))
   {
   fxpanel.hide();
   }
  
   Platform.runLater(new Runnable())
  {
  
   public void run()
   {
    init Fx(fxpanel);
    }}
   );
   }
   private static void initFX(final JFXPanel fxpanel) 
  {
    Group group = ne Group();
    Scene scene= new Scene(group);
    fxpanel.setScene(scene);
    WebView webview= new WebView();
    group.getChildren().add(webview);
    webview.setMinSize(500,500);
    webview.setMaxSize(500,500);
    eng=webview.getEngine();
    File file= new File("d:/new folder/abc.html");
    try
   {
   eng.load(file.toURI().toURL().toString());
   }
  catch(Exception ex)
  {
  }
  }
  public static void main(String args[])
  {
   abc f1= new abc();
   f1.show();
  }
  }
  </code></pre>