Results 1 to 5 of 5

Thread: small problem

  1. #1
    barusk is offline Member
    Join Date
    Feb 2009
    Posts
    40
    Rep Power
    0

    Default small problem

    could anyone help me out with either some javacode or javascript to add to my html. that when i click exit on my applet is also closes the browser window which the applet is embeded in.

  2. #2
    barusk is offline Member
    Join Date
    Feb 2009
    Posts
    40
    Rep Power
    0

    Default

    sorry didnt specify earlier that i have already a button in my applet that closes the applet. im not just using the X on the applets window.

  3. #3
    Aseem is offline Senior Member
    Join Date
    Mar 2009
    Location
    USA
    Posts
    127
    Rep Power
    0

    Default

    applet is run on browser so when you close the applet ...browser will close.

  4. #4
    barusk is offline Member
    Join Date
    Feb 2009
    Posts
    40
    Rep Power
    0

    Default

    it's not closing the browser window i think because. the applet it self opens a seperate window for the frame of my applet. so it has its own appletviewer window that seperate from the browser window. is there some script to let the browser window know that the applets window has been closed?

  5. #5
    Xyle's Avatar
    Xyle is offline Member
    Join Date
    Feb 2009
    Location
    Nevada
    Posts
    34
    Rep Power
    0

    Default

    Not having crossed this issue myself, checking google gave me this...

    rgagnon.com/javadetails/java-0282.html

    Have a Java button close the browser window - Real's Java How-to

    Java Code:
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import netscape.javascript.*;
    
    public class WinClose extends Applet 
            implements ActionListener{
    
    Button wc = new Button("Close me");
    
    public void init() {
     wc.setActionCommand("CLOSE");
     wc.addActionListener(this);
     add(wc);
     }
    
    public void actionPerformed(ActionEvent e) {
      String command = e.getActionCommand();
      if (command.equals("CLOSE")) {
       JSObject win = (JSObject) JSObject.getWindow(this);
       win.eval("self.close();");
       }
      }
    }
    Hopefully this helps! :D

Similar Threads

  1. small problem in connection
    By BsBs in forum CLDC and MIDP
    Replies: 1
    Last Post: 01-27-2009, 06:03 AM
  2. A small Question
    By Eku in forum JDBC
    Replies: 7
    Last Post: 09-01-2008, 06:10 AM
  3. Urgent small code
    By karingulanagaraj in forum New To Java
    Replies: 7
    Last Post: 08-11-2008, 04:11 AM
  4. Small problem
    By ayoood in forum New To Java
    Replies: 2
    Last Post: 06-06-2008, 12:27 PM
  5. small error
    By ayoood in forum New To Java
    Replies: 23
    Last Post: 05-27-2008, 12:18 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
  •