I try to set my applet go to the specific URL but applet does not go to the new web page
It seems getAppletContext().showDocument did not work
package dicegame; import java.awt.*; import java.net.MalformedURLException; import java.net.URL; import javax.swing.JApplet; import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; public class game extends JApplet { private JLabel appletScoreLabel; public void init() { try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { createGUI(); } }); } catch (Exception e) { System.err.println("createGUI didn't successfully complete"); } } private void createGUI() { this.setSize(240, 300); final roll gamepanel = new roll(); appletScoreLabel = new JLabel(""+gamepanel.score, SwingConstants.CENTER); gamepanel.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { int score = gamepanel.score; appletScoreLabel.setText(String.valueOf(score)); gameover(score); } }); JPanel statusPanel = new JPanel(); statusPanel.add(new JLabel("Score (in the Applet): ")); statusPanel.add(appletScoreLabel); getContentPane().add(gamepanel, BorderLayout.CENTER); getContentPane().add(statusPanel, BorderLayout.SOUTH); } public void gameover(int s){ System.out.println(s); if(s<=0) { try { System.out.println("hello"); this.getAppletContext().showDocument (new URL(getCodeBase()+"test.php"),"_self"); } catch (MalformedURLException e1) { System.out.println("error"); e1.printStackTrace(); } } }