So my Applet work like that :
The main .class is extended from JApplet
, therefore it can be use as an applet.
This main class load other .class file to display new window, that are extented from JPanel.
This current set up work fine as an applet, however, in one of my JPanel
class I have a button that open an URL. I use the Desktop API and it works fine on the browser, the problem is : It opens the URL in the same tab as the applet.
I would like the URL to open in a new tab from my JPanel
. I know I can use something like :
AppletContext a = getAppletContext();
URL url = new URL(link);
a.showDocument(url,"_blank");
but the method getAppletContext()
only work from a class that has extented JApplet, not a JPanel.
I have tried to change my Jpanel
to a JApplet
but that seems to create some kind of mess.
Any idea how I could achieve that ?
Thank you !