Hello, I want to reinitialize an applet inside a JPanel (the view/class extends JPanel). For example, I have the following method:
/** * {@inheritDoc} */ @Override public void refreshInit() { mDB = mNotifier.getGUI().getReadDB(); boolean firstInit = mEmbed == null ? true : false; // Create instance of processing innerclass. if (!firstInit) { mEmbed.dispose(); } mEmbed = new Embedded(this, mNotifier); if (firstInit) { add(mEmbed); } else { revalidate(); repaint(); } /* * Important to call this whenever embedding a PApplet. * It ensures that the animation thread is started and * that other internal variables are properly set. */ mEmbed.init(); mEmbed.refreshInit(); } mEmbed is an instance of a inner class which extends PApplet, the processing core-class which itself extends Applet. The thing is it doesn't reinitialize the new applet somehow properly and the JMenuBar of the parent frame is greyed out but can be used nontheless. The following code worked for extending JScrollPane: /** * {@inheritDoc} */ @Override public void refreshInit() { mDB = mNotifier.getGUI().getReadDB(); if (mEmbed != null) { mEmbed.mControl.getGUIInstance().mParent.dispose(); mEmbed.mControl.getGUIInstance().resetGUI(); mEmbed.mControl.resetControl(); mEmbed.mEmbeddedView.resetEmbedded(); mEmbed.mEmbeddedView = null; // mEmbed.dispose(); mEmbed = null; } // Create instance of processing innerclass. mEmbed = new Embedded(this, mNotifier); setViewportView(mEmbed); /* * Important to call this whenever embedding a PApplet. * It ensures that the animation thread is started and * that other internal variables are properly set. */ mEmbed.init(); mEmbed.refreshInit(); } kind regards, Johannes