Hi,
 
I'm a very very NOVICE to java.
 
I have mixed to examples from Steven Holzner's "Learning by examples".
 
And it works fine if I dont put the string "_self" in the URL method.
 
Reading www.javasoft.com this should work. Am I doing something completely foolish?
 
I want to keep the frame showing a new document. 
 
And one more thing. Does anybody know why "some text" in method newpopupmenu does appear using netscape but won't appear using MS Explorer 4.0.?
 
TIA 
 
Poul  
 
 
      import java.applet.Applet;
        import java.awt.*;
        import java.awt.event.*;
        import java.net.*;
 
        public class popupx extends Applet implements ActionListener, MouseListener {
                TextField text1;
                PopupMenu popup;
                MenuItem menuitem1, menuitem2, menuitem3;
               
                public void init(){
 
                        popup = new PopupMenu("some text");
                        menuitem1 = new MenuItem("2000");
                        menuitem1.addActionListener(this);
                        menuitem2 = new MenuItem("1999");
                        menuitem2.addActionListener(this);
                        menuitem3 = new MenuItem("1998");
                        menuitem3.addActionListener(this);
                        popup.add(menuitem1);
                        popup.add(menuitem2);
                        popup.addSeparator();
                        popup.add(menuitem3);
                        add(popup);
                        text1 = new TextField(30);
                        add(text1);
                        addMouseListener(this);
                }
 
                public void mousePressed(MouseEvent e){
                        if(e.getModifiers() != 0){
                                popup.show(this, e.getX(), e.getY());
                        }
                }
 
                public void mouseClicked(MouseEvent e){
                }
 
                public void mouseReleased(MouseEvent e){
                }
 

                public void mouseEntered(MouseEvent e){
                }
 
                public void mouseExited(MouseEvent e){
                }
 
        public void actionPerformed(ActionEvent event){
            if(event.getSource() == menuitem1){
            URL newURL = null;
                  {
                         try { newURL = new URL("http://www.sfi.dk/pub/show2000.php3","_self");}
                           catch (MalformedURLException e1 ) {}
                            getAppletContext().showDocument(newURL);
                  }
                                              }
            if(event.getSource() == menuitem2){
            URL newURL = null;
                  {
                         try { newURL = new URL("http://www.sfi.dk/show1999.php3","_self");}
                           catch (MalformedURLException e2 ) {}
                            getAppletContext().showDocument(newURL);
                  }
                                              }
            if(event.getSource() == menuitem3){
            URL newURL = null;
                  {
                         try { newURL = new URL("http://www.sfi.dk/pub/show1998.php3","_self");}
                           catch (MalformedURLException e2 ) {}
                            getAppletContext().showDocument(newURL);
                  }
                   
            }
        }
 
        }
 

Reply via email to