Results 1 to 5 of 5
  1. #1
    Bomber_Will is offline Member
    Join Date
    Nov 2008
    Posts
    40
    Rep Power
    0

    Default HTML linking and java applets

    Is there a way to make a HTML link that if the user presses it, it would open a new window displaying an applet only? I seen some gaming websites that if you click on the link, a new window would open with just the game and none of the clutter the rest of a webpage would give.

  2. #2
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    see JavaScript methods for controlling windows

  3. #3
    Bomber_Will is offline Member
    Join Date
    Nov 2008
    Posts
    40
    Rep Power
    0

    Default

    I don't have a clue about JavaScript but i'll look into it, thanks.

  4. #4
    adrija_ghosh is offline Member
    Join Date
    Feb 2009
    Posts
    11
    Rep Power
    0

    Default

    Try this code to open a new window from an applet :

    import java.applet.*;
    import java.awt.*;
    import java.net.*;
    import java.awt.event.*;

    public class testURL_NewWindow extends Applet implements ActionListener{

    public void init(){
    String link_Text = "google";
    Button b = new Button(link_Text);
    b.addActionListener(this);
    add(b);
    }

    public void actionPerformed(ActionEvent ae){
    //get the button label
    Button source = (Button)ae.getSource();
    String link = "...give any link.....";
    try
    {
    AppletContext a = getAppletContext();
    URL url = new URL(link);
    a.showDocument(url,"_blank");
    // a.showDocument(url,"_self");
    // _self to open page in same window
    }
    catch (MalformedURLException e){
    System.out.println(e.getMessage());
    }
    }
    }

  5. #5
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Default

    Yeah, it is quite possible to open a new browser window by applet code showDocument(url,"_self");
    But the button must be in the applet too.

Similar Threads

  1. reading dir in java applets
    By willemjav in forum Java Applets
    Replies: 3
    Last Post: 02-07-2008, 12:36 AM
  2. Linking of exe files
    By archu2friends in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 02-06-2008, 06:08 AM
  3. <URGENT> problem after linking .jnlp
    By bongia in forum New To Java
    Replies: 14
    Last Post: 11-18-2007, 05:57 PM
  4. Linking code to GUI Interface
    By ai_2007 in forum Advanced Java
    Replies: 1
    Last Post: 07-02-2007, 01:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •