Applets/filechooser HELP!!!

i am currently constructing an applet to run online.
i have put in a "select" filechooser box that is supposed to appear when the button "select file" at the bottom of the applet is pressed.
The applet compiles OK but when i do press the select file JButton this error appears:
Starting appletviewer for I:\9603794\Diss\testGUI2.html
Exception occurred during event dispatching:
java.security.AccessControlException: access denied (java.util.PropertyPermission user.home read)
     at java.security.AccessControlContext.checkPermission(AccessControlContext.java, Compiled Code)
     at java.security.AccessController.checkPermission(AccessController.java, Compiled Code)
     at java.lang.SecurityManager.checkPermission(SecurityManager.java, Compiled Code)
     at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java, Compiled Code)
     at java.lang.System.getProperty(System.java, Compiled Code)
     at javax.swing.filechooser.FileSystemView.getHomeDirectory(FileSystemView.java:113)
     at javax.swing.JFileChooser.setCurrentDirectory(JFileChooser.java:408)
     at javax.swing.JFileChooser.<init>(JFileChooser.java:271)
     at javax.swing.JFileChooser.<init>(JFileChooser.java:233)
     at testGUI2.selectFile(testGUI2.java:96)
     at testGUI2$SelectActionListener.actionPerformed(testGUI2.java:87)
     at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1066)
     at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1101)
     at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:378)
     at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250)
     at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:204)
     at java.awt.Component.processMouseEvent(Component.java:3160)
     at java.awt.Component.processEvent(Component.java:2999)
     at java.awt.Container.processEvent(Container.java:990)
     at java.awt.Component.dispatchEventImpl(Component.java:2394)
     at java.awt.Container.dispatchEventImpl(Container.java:1035)
     at java.awt.Component.dispatchEvent(Component.java, Compiled Code)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2043)
     at java.awt.LightweightDispatcher.processMouseEvent(Container.java:1827)
     at java.awt.LightweightDispatcher.dispatchEvent(Container.java:1730)
     at java.awt.Container.dispatchEventImpl(Container.java:1022)
     at java.awt.Component.dispatchEvent(Component.java, Compiled Code)
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:287)
     at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:101)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:92)
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:83)
Any help would be much appreciated
THANKS.

The exceptions are thrown out because browser won't allow your applet to access the local file system for security reasons. What you can do, is either write a new policy file which give the permision to the applet to access your local file system, or create a java certificate which assign all the permisions to your applet.
Take a look at this article about certificate:
http://java.sun.com/docs/books/tutorial/security1.2/toolfilex/rstep1.html
Good luck!

Similar Messages

  • Swing applet- please help

    Hi,
    I am still trying to make sense of the java code...
    I thought it should be easy to create an applet, but I don't know what is wrong.
    Could anyone help me debugging it?
    Here is the code and the error msg:
    package BrImage;
    /* Example 16-3 An Image Previewer Accessory implements BrImagFile*/
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.beans.*;
    import java.io.*;
    import java.applet.Applet;
    public class BrImage extends JApplet {
    public void init() {
    getContentPane().add(new JLabel("JAppletSwing!"));
    public class BrImagFile extends javax.swing.JFrame {
    JFileChooser chooser = new JFileChooser();
    ImagePreviewer previewer = new ImagePreviewer();
    PreviewPanel previewPanel = new PreviewPanel();
    class PreviewPanel extends javax.swing.JPanel {
    public PreviewPanel() {
    JLabel label = new JLabel("Image Previewer",SwingConstants.CENTER);
    setPreferredSize(new Dimension(150,0));
    setBorder(BorderFactory.createEtchedBorder());
    setLayout(new BorderLayout());
    label.setBorder(BorderFactory.createEtchedBorder());
    add(label, BorderLayout.NORTH);
    add(previewer, BorderLayout.CENTER);
    public BrImagFile() {
    super("Image Previewer");
    Container contentPane = getContentPane();
    JButton button = new JButton("Select A File");
    contentPane.setLayout(new FlowLayout());
    contentPane.add(button);
    chooser.setAccessory(previewPanel);
    button.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    int state = chooser.showOpenDialog(null);
    File file = chooser.getSelectedFile();
    String s = "CANCELED";
    if(file != null && state == JFileChooser.APPROVE_OPTION) {
    s = "File Selected: " + file.getPath();
    /* needs to open file on the right html */
    JOptionPane.showMessageDialog(null, s);
    chooser.setFileFilter(new ImageFilter()); /*test filter */
    chooser.addPropertyChangeListener(
    new PropertyChangeListener() {
    public void propertyChange(PropertyChangeEvent e) {
    if(e.getPropertyName().equals(
    JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)) {
    File f = (File)e.getNewValue();
    String s = f.getPath(), suffix = null;
    int i = s.lastIndexOf('.');
    if(i > 0 && i < s.length() - 1)
    suffix = s.substring(i+1).toLowerCase();
    if(suffix.equals("gif") ||
    suffix.equals("jpg") ||
    suffix.equals("bmp"))
    previewer.configure(f);
    class ImagePreviewer extends javax.swing.JLabel {
    public void configure(File f) {
    Dimension size = getSize();
    Insets insets = getInsets();
    ImageIcon icon = new ImageIcon(f.getPath());
    setIcon(new ImageIcon(icon.getImage().getScaledInstance(
    size.width - insets.left - insets.right,
    size.height - insets.top - insets.bottom,
    Image.SCALE_SMOOTH)));
    class ImageFilter extends javax.swing.filechooser.FileFilter {
    public boolean accept(File f) {
    boolean accept = f.isDirectory();
    if( ! accept) {
    String suffix = getSuffix(f);
    if(suffix != null)
    accept = suffix.equals("jpg") ||
    suffix.equals("gif") ||
    suffix.equals("bmp");
    return accept;
    public String getDescription() {
    return "Image Files(*.gif *.jpg *.bmp)";
    private String getSuffix(File f) {
    String s = f.getPath(), suffix = null;
    int i = s.lastIndexOf('.');
    if(i > 0 && i < s.length() - 1)
    suffix = s.substring(i+1).toLowerCase();
    return suffix;
    public static void main(String a[]) {
    JApplet applet = new BrImage();
    JFrame f = new BrImagFile();
    f.setBounds(300, 300, 300, 75);
    applet.init();
    applet.start();
    f.setVisible(true);
    /* f.setDefaultCloseOperation(
    WindowConstants.DISPOSE_ON_CLOSE); */
    f.addWindowListener(new WindowAdapter() {
    public void windowClosed(WindowEvent e) {
    System.exit(0);
    BrImage/BrImage.java [109:1] non-static variable this cannot be referenced from a static context
    JFrame f = new BrImagFile();
    ^
    1 error
    Errors compiling BrImage.

    Hi again,
    Please help.
    JL

  • I want to create an applet, Please Help...

    HI all,
    I want to create an applet which should be able to display text and images...
    To display text in an applet I am using ...
    import java.awt.*;
    import java.applet.*;
    public class SimpleApplet extends Applet
        public void paint(Graphics g)
            g.drawString("A Simple Applet", 20, 20);
    }Now If I want to create few operators in a different class, and i want to use it from the SimpleApplet class what should be doing.

    HI all,
    I am creating an Gui: The code is here:
    import javax.swing.*;
    import java.awt.*;
    public class Tab extends JFrame
        JPanel p,p1,p2,p3,p4,p5;
        Frame f1,f2,f3;
        JTabbedPane tpane;
        public Tab()
            p = new JPanel();
            p1 = new JPanel();
            p2 = new JPanel();
            p3 = new JPanel();
            p4 = new JPanel();
            p5 = new JPanel();
            tpane = new JTabbedPane();
            p.setLayout(new GridLayout(1,1));
            tpane.addTab("File",p1);
            tpane.addTab("Edit",p2);
            tpane.addTab("Document",p3);
            tpane.addTab("View",p4);
            tpane.addTab("Help",p5);
            p.add(tpane);
            getContentPane().add(p);
            setVisible(true);
        public static void main(String[] args)
            // TODO Auto-generated method stub
            Tab t = new Tab();
    }I want to diaplay some text in the main area left. What should I do.
    How to add the Text.

  • Applet Security help for a newbie

    I have an applet that works as an IRC client, still needs a lot of work. I have the basics working, but before I continue fixing it up I need some help. I've searched all over the forums, and my lack of Java knowhow leaves me confused.
    I have no idea how to use the forte debugger or the J++ debugger, so i'm building the classes everytime and testing them in IE on my own machine.
    I got this error first:
    java.security.AccessControlException: access denied (java.net.SocketPermission irc.enterthegame.com resolve)
    so I did a lot of searching and found that by adding the following lines to my java.policy file in my program files\java\j2re1.4.0\lib\security folder that it would work:
    permission java.net.SocketPermission "*:80", "connect,accept,resolve";
    permission java.net.SocketPermission "*:6667", "connect,accept,resolve";
    Unfortunately if I want to test my applet on another computer or just use it, it means I have to add these lines on every machine I want to use. I think.
    So I did some more searching on here...and now I think I have to sign my applet. I followed the instructions from this link http://developer.java.sun.com/developer/qow/archive/167/index.jsp
    And that all went well. But what do I do now? I took out those two permission lines from my java.policy file and it's back to square one. Do I need to do something with the .jar file that I created? Can someone give me a hand here? Thanks, I appreciate it

    Is this question really hard or something?

  • Applet Urgent Help Plz

    Hello Everyone, im having a major problem with this applet.I am trying to create a Black Jack card game to play around.It is compiling with no errors however the applet doesnt seem to get initialised thus it is not possible to be viewed in the applet viewer. What im trying to achieve is being able to draw 2 cards in the deck. Ever since i tried to use the showBlackjackScore() method as well as the init()method things started to get serious.These methods implementations were taken from: http://nifty.stanford.edu/2004/EstellCardGame/code.html were the Card, Deck, Hand, Rank, and Suit classes are also implemented, and are used with this program. Would appreciate any help! Other than that, the Gui is of my own and is a really nice example for ideas in your future java programs.Thanks in Advance!
    import javax.swing.*;     
    import java.awt.*;     
    import java.awt.event.*;
    import javax.swing.border.*;
    import java.util.*;
    public class BlackJackClient extends JApplet
         private Deck cardDeck;
        private BlackjackHand myHand;
        private final int SIZE_OF_HAND = 2;
        private final String directory = "cards/";
            private JLabel[] handLbl = new JLabel[ SIZE_OF_HAND ];
         private Container container;
         private JPanel panel1,panel2,Flow,Opponent,Player;
         private JPanel cardsTop,cardsBottom;
         private JLabel Player_Status;
         private JLabel top_card1,top_card2,top_card3,top_card4,top_card5;
         private JLabel bottom_card1,bottom_card2,bottom_card3,bottom_card4,bottom_card5;
         private TitledBorder opponent,player;
         private TitledBorder Cr1,Cr2,Cr3,Cr4,Cr5;
         private TitledBorder B1,B2,B3,B4,B5;
         private JPanel box1,box2,box3,box4,box5,box6,box7,box8,box9,box10;
         private JTextArea Messages;
         private JButton Hit,Stand,JButton1;
         private JLabel scoreLbl;
        public BlackJackClient()//CONSTRUCTOR
             container=getContentPane();
             container.setLayout(new BoxLayout(container,BoxLayout.Y_AXIS));
             scoreLbl.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
              scoreLbl.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
              getContentPane().add(scoreLbl);
              scoreLbl.setForeground(java.awt.Color.black);
              scoreLbl.setFont(new Font("Dialog", Font.BOLD, 64));
              scoreLbl.setBounds(252,48,103,88); 
             //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++PANELS
             JPanel p = new JPanel();
              p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
              Opponent=new JPanel();
             Player=new JPanel();
             cardsTop=new JPanel(new FlowLayout(FlowLayout.CENTER,10,15));
             cardsBottom=new JPanel(new FlowLayout(FlowLayout.CENTER,10,15));
             panel1=new JPanel();          
             panel2=new JPanel();     
             box1=new JPanel();
             box2=new JPanel();
             box3=new JPanel();
             box4=new JPanel();
             box5=new JPanel();
             box6=new JPanel();
             box7=new JPanel();
             box8=new JPanel();
             box9=new JPanel();
             box10=new JPanel(); 
             Flow=new JPanel(new FlowLayout(FlowLayout.RIGHT,3,0));
              //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
              JLabel label=new JLabel("Welcome To BlackJack 21",SwingConstants.CENTER);
              label.setForeground(Color.white);
              label.setFont(new Font("Futura",Font.BOLD,19));
              panel1.add(label);
              panel1.setBackground(Color.black);
             Icon card1=new ImageIcon("Trapula/c1.png");
             top_card1=new JLabel(card1);
             Icon card2=new ImageIcon("Trapula/d1.png");
             top_card2=new JLabel(card2);
             Icon card3=new ImageIcon("Trapula/h1.png");
             top_card3=new JLabel(card3);
             Icon card4=new ImageIcon("Trapula/s1.png");
             top_card4=new JLabel(card4);
             Icon card5=new ImageIcon("Trapula/ck.png");
             top_card5=new JLabel(card5);
             box1.add(top_card1);
             cardsTop.add(box1);
             box2.add(top_card2);
             cardsTop.add(box2);
             box3.add(top_card3);
             cardsTop.add(box3);
             box4.add(top_card4);
             cardsTop.add(box4);
             box5.add(top_card5);
             cardsTop.add(box5);
                Cr1 = new TitledBorder(new LineBorder(Color.black,2), "");
                 box1.setBorder(Cr1);
                 box1.setBackground(Color.gray);
             Cr2 = new TitledBorder(new LineBorder(Color.black,2), "");
                 box2.setBorder(Cr2);
                 box2.setBackground(Color.gray);
                 Cr3 = new TitledBorder(new LineBorder(Color.black,2), "");
                 box3.setBorder(Cr3);
                 box3.setBackground(Color.gray);
                 Cr4 = new TitledBorder(new LineBorder(Color.black,2), "");
                 box4.setBorder(Cr4);
                 box4.setBackground(Color.gray);
                 Cr5 = new TitledBorder(new LineBorder(Color.black,2), "");
                 box5.setBorder(Cr5);
                 box5.setBackground(Color.gray);
                 opponent=new TitledBorder(new LineBorder(Color.black,5),"Opponent");
                 Opponent.setBorder(opponent);
                 Opponent.add(cardsTop);
                 Opponent.setBackground(Color.green);
             cardsTop.setBackground(Color.green); 
             //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                 Icon card6=new ImageIcon("Trapula/s4.png");
                bottom_card1=new JLabel(card6);
                 Icon card7=new ImageIcon("Trapula/s5.png");
                 bottom_card2=new JLabel(card7);
                 Icon card8=new ImageIcon("Trapula/s6.png");
                 bottom_card3=new JLabel(card8);
                 Icon card9=new ImageIcon("Trapula/s7.png");
                 bottom_card4=new JLabel(card9);
                 Icon card10=new ImageIcon("Trapula/s8.png");
                 bottom_card5=new JLabel(card10);
                 box6.add(bottom_card1);
             cardsBottom.add(box6);
             box7.add(bottom_card2);
             cardsBottom.add(box7);
             box8.add(bottom_card3);
             cardsBottom.add(box8);
             box9.add(bottom_card4);
             cardsBottom.add(box9);
             box10.add(bottom_card5);
             cardsBottom.add(box10);
                 B1=new TitledBorder(new LineBorder(Color.black,2), "");
                 box6.setBorder(B1);
                 box6.setBackground(Color.gray);
                 B2=new TitledBorder(new LineBorder(Color.black,2), "");
                 box7.setBorder(B2);
                 box7.setBackground(Color.gray);
                 B3=new TitledBorder(new LineBorder(Color.black,2), "");
                 box8.setBorder(B3);
                 box8.setBackground(Color.gray);
                 B4=new TitledBorder(new LineBorder(Color.black,2), "");
                 box9.setBorder(B4);
                 box9.setBackground(Color.gray);
                 B5=new TitledBorder(new LineBorder(Color.black,2), "");
                 box10.setBorder(B5);
                 box10.setBackground(Color.gray);
                 player=new TitledBorder(new LineBorder(Color.black,5),"Player");
                 player.setTitleColor(Color.black);
                 Player.setBorder(player);
                 JPanel Hand=new JPanel();
             JButton1=new JButton("Draw Hand");
                 JButton1.setActionCommand("Draw a Hand");
                 JButton1.addActionListener(new ActionListener()
                 {     public void actionPerformed(ActionEvent e)
                      {     Object object=e.getSource();
                                if(e.getSource()==object)
                                {     cardDeck.restoreDeck();
                                  cardDeck.shuffle();
                                  myHand.discardHand();
                                       for ( int i = 0; i < SIZE_OF_HAND; i++ )
                                       {   Card c = cardDeck.dealCard();
                                               myHand.addCard( c );
                                               handLbl.setIcon( c.getCardImage() );
                                            handLbl[i].setText( c.toString() );
                        showBlackjackScore();
         Hand.add(JButton1);
         Hand.setBackground(Color.green);
         cardsBottom.setBackground(Color.green);
         Player.setBackground(Color.green);
         Player.add(cardsBottom);
         //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
         Messages=new JTextArea("----------------------------------------------------Messages-------------------------------------------------\n\n\n",10,42);
         JScrollPane scroller=new JScrollPane(Messages);
         Messages.setEditable(false);
         Messages.setForeground(Color.white);
         Messages.setBackground(Color.gray);
         panel2.setBackground(Color.green);
         panel2.add(scroller);
         //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
         JButton Exit=new JButton("Exit");
         Exit.setToolTipText("Disconnect");
         Hit=new JButton("Hit");
         Hit.setToolTipText("Ask another card?");
         Stand=new JButton("Stand");
         Stand.setToolTipText("Satisfied with your card/s?");
         JLabel l1=new JLabel(" ");
         JLabel l2=new JLabel(" ");
         JLabel l3=new JLabel(" ");
         JLabel l4=new JLabel(" ");
         JLabel l5=new JLabel(" ");
         Exit.addActionListener(new ActionListener()
                   {public void actionPerformed(ActionEvent e)
                        {System.out.println("Disconnected from BlackJack Thank you for Gambling!");
                         System.exit(0);
         Hit.addActionListener(new ActionListener()
                   {public void actionPerformed(ActionEvent e)
                        {Messages.append("Hit Me!!\n");}
         Stand.addActionListener(new ActionListener()
                   {public void actionPerformed(ActionEvent e)
                        {Messages.append("Stand\n");}
         Flow.add(l1);
         Flow.add(l2);
         Flow.add(l3);
         Flow.add(l4);
         Flow.add(l5);
         Flow.add(Exit);
         Flow.add(Hit);
         Flow.add(Stand);          
         Flow.setBackground(Color.green);
         p.add(Flow);
         //++++++++++++++++++++++++++++++++++++++++++++++++++++
         container.add(panel1);
         container.add(Opponent);
         container.add(Player);
         container.add(Hand);
         container.add(panel2);
         container.add(p);
    }//end of Black Jack client constructor
         public void init()
         {     cardDeck = new Deck();
                   Iterator suitIterator = Suit.VALUES.iterator();
                        while ( suitIterator.hasNext() )
                        {   Suit suit = (Suit) suitIterator.next();
                        Iterator rankIterator = Rank.VALUES.iterator();
                             while ( rankIterator.hasNext() )
                                  {     Rank rank = (Rank) rankIterator.next();
                                  String imageFile = directory + Card.getFilename( suit, rank );
                             ImageIcon cardImage = new ImageIcon( getImage( getCodeBase(), imageFile ) );
                             Card card = new Card( suit, rank, cardImage );
                             cardDeck.addCard( card );
         }//end of init      
    private void showBlackjackScore()
         int score = myHand.evaluateHand();
              if( score == 21 )
              {     scoreLbl.setText( score + "!" );
              scoreLbl.setForeground( Color.red );
              else
              {     scoreLbl.setText( "" + score );
              scoreLbl.setForeground( Color.black );
              }//end of showBlackjackScore      
    }//end of class Black Jack client

    I might be wrong, but maybe the init() method isn't showing any GUI because you're not creating or adding any components there.
    Rather than putting all the Swing code in your constructor, put it in a method that returns your top-level component, such as:
    private Component createComponents() {
            // blah
    }Then, in your init() method, try something like:
         public void init() {
              try {
                   SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                             createComponents();
              catch (Exception e) {
                   System.err.println("Applet could not be created succesfully");
                   e.printStackTrace();
         }Do you get any error messages with your current program?
    Message was edited by:
    Djaunl

  • Scrolling applet - need help

    I have an applet that contains too much information to fit on the screen, so I need a scrollbar so I can view the rest. The kind of scrollbar that's on the side of a web browser that lets you scroll down to view the rest of the page. It's a class that extends Applet and implements MouseListener and ActionListener. I've looked around the internet for the solution for an hour and found nothing. Any help would be much appreciated

    Put a JScrollpane your ScrollPane as the main Panel of your applet, then put the content of your applet in a JPanel yourPanel and finaly call yourScrollPane.setViewPortView(yourPanel).
    Try that. It should work.

  • Applet design help needed...

    Hello and thank you if you decide to reply to this post. I am a former C++ programmer (intermediate level) jumping head-first into Java.
    The first project I have made for myself is a web-based gui packet sniffer. Here is the physical setup: I have a Linux box on my network running a packet sniffing program (tcpdump for those interested) and a web server (apache, again for those interested).
    I would like to write a Java program on the Linux box that would redirect the packet sniffing program's output to a webpage viewable on the internet (and my internal network).
    At first, I wrote an applet to redirect the output to a webpage but could not view it over my internal network. I thought maybe I needed to write a client and server program that creates sockets to pass information over the network (and internet), but I have been to webpages that display realtime output in text and graphical form without using special clientside code.
    I guess I am saying is that I know this can be done, but I'm not sure how to do it.

    tcpdump can write to the screen of the computer it is running on (standard output) or to a file in realtime. Have you ever opened a console to ping a host like: "ping www.yahoo.com"? You'll get an ICMP reply like: "Reply from 64.58.76.227: bytes=32 time=50ms TTL=236" In case you didn't know, 'ping' is a simple program that uses a sub protocol of TCP/IP (the protocol of the internet) called ICMP to send a request to a given machine and listen for a reply. Once it recieves the reply, it prints it to the screen and says how big the message sent was (in the above case 32 bytes) how long it took to get there (in the above case 50 milliseconds) and how long ping should wait intil it should declare the target (in the above case www.yahoo.com) as a 'Request timed out'. This wait period is called a Time To Live or TTL (in the above case 236 milliseconds)
    Now imagine information like this, but for ALL the data traffic coming in and out of a certain network card on the computer running tcpdump. This information scrolls on the screen, or to a file, about as fast as you can scroll through a full text document. Of course there are arguments to tcpdump to request more or less or specific information about data packets traveling to the host machine.
    Simply put, what I would like is the ability to open a webpage (residing on and being served from the same machine running tcpdump) and see tcpdump's output as if I were looking at the monitor of the computer it is running on. Also, I would like to be able to open this webpage from anywhere on my network or on the internet.
    I know how to serve webpages to the internet or to a network, the problem is writing Java code to output it to the webpage. Later I plan to make graphs of network bandwith usage or protocol frequency, but for now I am just trying to figure out how to direct tcpdump's output to a webpage and view it in realtime.
    So far, I have written code (with the help of the GREAT Forum community here) that executes tcpdump, redirects the standard output to BufferedReadert and then prints that BufferedReader to the screen. Here is the code:
    public class tcpdumpReadOutputNonApplet
    public static void main(String args[])
         try
              Process tcpdump = Runtime.getRuntime().exec("/usr/sbin/tcpdump -l -i any");
              System.out.println("PROCESS STARTED...");
              BufferedReader in = new BufferedReader(new InputStreamReader(tcpdump.getInputStream()));
              System.out.println("STREAM READ INTO BUFFER...");
              String tcpdumpStream;
              while ((tcpdumpStream = in.readLine()) != null)
              {       //print the output to screen
                   System.out.println(tcpdumpStream);
              }//end while
         }//end try
         catch (Exception e)
              String error = e.toString();
              System.out.println("EXCEPTION OCCURED!");
              System.out.println(error);
    }//end main()
    }//tcpdumpReadOutput()
    Once I got that to work, my next step was to try to redirect the BufferedReader to print to a webpage, but it didn't work. I thought (perhaps foolishly) that all I had to do was change this application into an applet and replace System.out.println with a drawString meathod. Well it didn't work. At least over my internal network. Something I might add is that the webpage I tried this on was not being served thru a webserver. It was just an HTML file that was opened over the network. Maybe this has something to do with it but I am doubtful.
    So that is my dilemma. Hope this post isn't too painful to read ^_^

  • APPLETS PLEASE HELP !!!!!!

    Does anyone know how to close an applet dynamically from within its own code.
    Have tried via javascript but the applet I created using the object tag fails to communicate correctly. Says 'Object does not support this operation'.
    If anyone can help I would be grateful as this is a major issue now.
    Thanks Andrew Mercer

    Thankyou very much for your help.
    I can now use java code from an applet to close the window that surrounds this applet.
    However I still have one problem that I cannot solve by looking through the documentation.
    My applet basically is used to copy files from server to client cache. Once each file is fully copied over then the applet has done its job and can be closed.
    The main Browser window stays open all this time and each applet window is opened and file transfered by hitting a link on this window from a list of links that can run into 100's.
    The first time this operation is requested the JSObject.getWindow(this) call returns a valid reference to the applet within the window.
    Once the first window is closed the next JSOBject.getWindow(this) fails, in fact it goes no further and does not return an exception or suitable message.
    This happens even if I have closed the window manually.
    How can I use the getWindow(this) call for subsequent windows?
    Depending where I put the getWindow(this) I can actually make the applet init operation stall and go no further.
    Thanks again.
    Andrew Mercer

  • Need applet deployment help!

    Hey everyone,
    I'm having an issue understanding why my .jnlp file is seemingly being ignored. I'm trying to deploy an applet as follows:
    <body bgcolor="Black">
    <br><br><br><br><br>
    <center>
    <script src="http://www.java.com/js/deployJava.js"></script>
    <script>
        var attributes = {code:'System.AppletShell', width:800, height:600};
        var parameters = {jnlp_href: 'NGEngine.jnlp'};
        deployJava.runApplet(attributes, parameters, '1.6');
    </script>
    </center>
    </body>And my jnlp configuration file is as follows:
    <?xml version="1.0" encoding="windows-1252"?>
      <jnlp codebase="http://localhost/applet">
        <information>
          <title>Project Foundation</title>
          <vendor>Company</vendor>
          <homepage href="http://www.company.com"/>
          <icon href="EconomicCenter.jpg">
            <kind>splash</kind>
         <height>100</height>
         <height>200</height>
          </icon>
          <offline-allowed/>
          <shortcut online="true">
            <desktop/>
            <menu submenu="Company"/>
          </shortcut>
        </information>
        <resources>
          <java version="1.3+" initial-heap-size="128m" max-heap-size="512m"/>
          <jar href="NGEngine.jar"/>
          <extension name="jogl" href="http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jnlp"/>
        </resources>
      <applet-desc main-class="System.AppletShell" name="Project Foundation" width="800" height="600">
    </jnlp>The problem is that I can get the applet to run if I specify to the deployment SCRIPT, the following parameters: code, codebase, and archive. At that point, the applet runs but it can't find my my jogl extension. If I manually feed the .jnlp file to web start everything starts up fine. Also, I am hosting these files via apache, and the .jnlp mime type has been set up correctly afaik (mime.types).
    So, why is it that the .jnlp file is seemingly being ignored?
    Thanks ahead of time!
    Edited by: dyamanoha on Mar 7, 2010 3:57 PM

    Thanks for the reply. Just a quick note, I'm both relatively new at coding in Java, and completely new at deploying anything in Java, so if any of these questions stem from a lack of research on my part, I apologize.
    I've been using both these resources as primary references:
    1* [http://java.sun.com/docs/books/tutorial/deployment/deploymentInDepth/runAppletFunction.html], and
    2* [http://java.sun.com/javase/technologies/desktop/javawebstart/download-spec.html] (the 6.0.10 specification / 6.0.18?)
    You stated that "An embedded applet JNLP should have no code base specified... ". However, according to 1*: "... if some deployment options have different values in the attribute name-value pairs and in the JNLP file ... leave the codebase attribute empty or specify an absolute URL. When the codebase attribute is left empty, it defaults to the directory containing the JNLP file." This is a bit confusing for me, because if I remove codebase attribute from the jnlp, which happens to be the "absolute path to the directory containing the JNLP file", I suddenly get an application error from the jdk web start tool: "BadFieldException[ The field <icon>href has an invalid value: EconomicCenter.jpg,EconomicCenter.jpg]". (The jdk tool starts everything perfectly fine if the codebase attribute is present.)
    So I thought that specifying the document base might fix this issue, since my EconomicCenter.jpg resides in the same directory as document base, but that didn't seem to work.
    Further, I have some confusion surrounding the point of the code attribute that deployJava.runApplet consumes. What is the difference between the code attribute, and the main-class attribute of the jnlp's applet-desc element?
    If I try to launch the embedded applet/jnlp, from my browser, I get the error: "load: class System.AppletShell not found.", and the jnlp file is still seems to be ignored.
    Also, I downloaded janela although it hasn't helped terribly much to get my feet off the ground yet, but here's the output in any case (with codebase removed from the jnlp open tag).
    JaNeLA Report - version 10.03.07
    Report for http://localhost/applet/ngengine.jnlp
    XML encoding not known, but declared as UTF-8
    Codebase not specified.  Defaulting to http://localhost/applet/
    Desktop icons were subject to bug nnnn in earlier J2SE versions
    Downloads can be optimized by specifying a resource size for 'NGEngine.jar'.
    The resource download at NGEngine.jar can be optimized by removing the (default) value of download='eager'.
    The resource download at NGEngine.jar can be optimized by removing the (default) value of main='false'.
    It might be possible to optimize the start-up of the app. by  specifying download='lazy' for the NGEngine.jar resource.
    Lazy downloads might not work as expected for NGEngine.jar unless the download 'part' is specified.
    Downloads can be optimized by specifying a resource size for 'EconomicCenter.jpg'.
    Icon loading & use can be optimized by specifying the width and height for EconomicCenter.jpgHere's the updated javascript call and jnlp with hopefully corrected changes:
    <script src="http://www.java.com/js/deployJava.js"></script>
    <script>
        var attributes = {code:'System.AppletShell', width:800, height:600};
        var parameters = {jnlp_href: 'NGEngine.jnlp'};
        deployJava.runApplet(attributes, parameters, '1.6');
    </script>
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp>
      <information>
        <title>Project Foundation</title>
        <vendor>Company</vendor>
        <icon href="EconomicCenter.jpg"/>
        <offline-allowed/>
        <shortcut online="true">
          <desktop/>
          <menu submenu="Company"/>
        </shortcut>
      </information>
      <resources>
        <java version="1.3+" initial-heap-size="128m" max-heap-size="512m"/>
        <jar href="NGEngine.jar"/>
        <extension name="jogl" href="http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jnlp"/>
      </resources>
      <applet-desc main-class="System.AppletShell" documentbase="http://localhost/applet/applet.html" name="Project Foundation" width="800" height="600"/>
    </jnlp>And just in case I'm screwing up my file structure:
    Directory of C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\applet
    03/08/2010  12:26 PM    <DIR>          .
    03/08/2010  12:26 PM    <DIR>          ..
    03/07/2010  03:48 PM               353 applet.html
    03/05/2010  03:09 PM               988 AppletShell - Copy.html
    01/31/2010  02:54 AM    <DIR>          cachedir
    03/08/2010  12:26 PM                 0 directory.txt
    03/05/2010  10:50 PM           163,002 EconomicCenter.jpg
    01/31/2010  02:21 AM    <DIR>          lib
    03/05/2010  03:32 PM        51,930,853 NGEngine.jar
    03/08/2010  12:15 PM               756 NGEngine.jnlp
                   6 File(s)     52,095,952 bytes
                   4 Dir(s)  30,308,773,888 bytes freeEdited by: dyamanoha on Mar 8, 2010 12:37 PM

  • Javascript-Applet connection: Help!

    Hi,
    Below is a JSP page followed by the Applet that it loads. The applet displays an inputDialog in the init() method and another int he setNum(...) method. Init() displays the dialog correctly, but setNum hangs IE completely when it displays de dialog. Where did I go wrong?
    Thanks for your help.
    Miguel
    PS Type a number in the text box and push the "Do" button.<HTML>
    <HTML>
    <HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    function send() {
    alert("send");
    var num = parseInt(document.forms[0].Num.value);
    document.applets[0].SetNum(num);
    alert("send: num..." + num);
    </SCRIPT>
    </HEAD>
    <BODY>
    <FORM>
    <BR>Num: <INPUT TYPE=TEXT NAME=Num>
    <BR><INPUT TYPE=BUTTON NAME="Do" VALUE="Do" onClick="send()">
    </FORM>
    <APPLET CODE="test.class" WIDTH = 500 HEIGHT = 250 MYSCRIPT>
    </APPLET>
    </BODY>
    </HTML>
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class test extends JApplet {
    public void init() {
    String str = JOptionPane.showInputDialog("init....");
    public void SetNum(int num) {
    String str2 = JOptionPane.showInputDialog("SetNum: " + num);

    zneroladivad,
    Thanks for your reply. My Tomcat console window does not show any output other than the messages during startup. I searched all of my computer but I could not find a file called plugin.trace.
    Just in case, the inputDialog actually shows the information I expected. The only trouble is that I can't dismiss it, I can't type data in it and, I can't select any IE options other than close the main window with the X at the top right corner.
    I hope this helps,
    Miguel

  • Sizing an Applet, Need help.

    The height parameter of the applet tag can be entered either in terms of number of pixels or % of the browser height.
    Is there a way to specify the height as the maximum of two: a fixed size, say, 500 pixels, and a fixed percent, say, 70%, of the browser height? If a Javascript is necessary, could someone help me out with that?
    Thanks in advance,
    Sooby Bhattacharjee, SDSU

    It is possible to use a % height in the html document and resize() the applet (within the applet) to 500 pixels in height if smaller.
    Faifai

  • Basic Math Applet - Need Help

    Hi all,
    I made program work fine as an application, but I cannot get it to work as an applet. I'm trying to write an applet that asks the user to enter two floating-point numbers, obtain the two numbers from the user and draws the sum, product, difference, and quotient of the two numbers.I appreicate any help. My main errors are in the calculations og *,/,-,+ .... I do not know how to fix this though I suspect it simple. Thanks for any help.
    import java.awt.Graphics;
    import javax.swing.*;
    public class Math extends JApplet {
         double sum, product, difference, quotient;
         public void init ()
              String firstNumber,
              secondNumber;
              Double number1,number2;
         firstNumber = JOptionPane.showInputDialog ("Enter first floating pt value" );
         secondNumber = JOptionPane.showInputDialog ("Enter second floating pt value");
         number1 = Double.parseDouble( firstNumber );
         number2 = Double.parseDouble( secondNumber );
         sum = number1 + number2;
         product = number1 * number2;
         difference = number1 - number2;
         quotient = number1 / number2;
         public void paint( Graphics g )
         g.drawRect(15, 10, 270, 20);
         g.drawString("The sum is: " + sum + "\n" +
         "The difference is: " + difference + "\n" + "The qoutient is: "
         + quotient + "\n" + "The product is: " + product, 25,25);
         System.exit (0);
    }

    Arrgg.... When I use this code in HTML it doesn't drop lines.
         public void paint( Graphics g )
         g.drawRect(15, 10, 270, 20);
         g.drawString("The sum is: " + sum + "\n" +
         "The difference is: " + difference + "\n" + "The qoutient is: "
         + quotient + "\n" + "The product is: " + product, 25,25);
    Why are the "\n" not working? Any thoughts?
    HTML:
    <html>
    <applet code="Math.class" width=500 height=200>
    </applet>
    </html>

  • Sending emails from inside an applet (Please help!)

    Hi all!
    I�d like to send an email from inside the applet. For this reason I need to get the Systemproperties, don't I ?
    Properties props = System.getProperties();
    props.put("mail.smtp.host", mailhost);
    ... and set the mail.smtp.host Property my smtp-host.
    But as I try to get the systemproperties from the applet, I get the exception:
    com.ms.security.SecurityExceptionEx[Sendmsg.<init>]: Unable to access system properties.
    Can somebody tell me, how I can solve this problem? Which properties are needed to send mails?
    Does it work, if I just create my Properties, and set only the smtp.host?
    As I continued my experiments, I realised that it is not only the mail.smtp.host property, that is needed by the applet, but java.home, and many more...
    So is it possible to send emails in this form at all??
    Pleeaaaase help, I have to hand in my project very soon!
    Thanks a lot,
    Gabor

    I've found a site about signing:
    http://www.suitable.com/Doc_CodeSigning.shtml
    I think you can read german, therefore the german newsgroup de.comp.lang.java is a good point to search. Use http://groups.google.com to search the group.
    Uwe

  • My Applet need help

    Don't get expected results from my Applet
    and Applet does not compile.
    // expected results in the JTextField "box"
    // AF.PA;36,39;4/5/2007;17h35;+1,25;35,53;36,62;35,52;2547827
    // LVMH.PA;84,28;4/3/2007;17h38;+1,16;83,80;84,58;83,32;1963844
    import java.applet.AppletContext;
    import javax.swing.*;
    import java.awt.GridBagLayout;
    import java.awt.GridBagConstraints;
    import java.awt.Insets;
    import java.awt.event.*;
    import java.net.URL;
    import java.net.MalformedURLException;
    import java.io.*;

    public class ShowDocument extends JApplet
                              implements ActionListener {
        the_URLWindow the_URLWindow;

        public void init() {
            //Execute a job on the event-dispatching thread:
            //creating this applet's GUI.
            try {
                SwingUtilities.invokeAndWait(new Runnable() {
                    public void run() {
                        createGUI();
            } catch (Exception e) {
                System.err.println("createGUI didn't successfully complete");

        private void createGUI() {
            JButton button = new JButton("Bring up the_URL window");
            button.addActionListener(this);
            add(button);

            JFrame.setDefaultLookAndFeelDecorated(true);
            the_URLWindow = new the_URLWindow(getAppletContext());
            the_URLWindow.pack();

        public void destroy() {
            //Execute a job on the event-dispatching thread:
            //creating this applet's GUI.
            try {
                SwingUtilities.invokeAndWait(new Runnable() {
                    public void run() {
                        destroyGUI();
            } catch (Exception e) { }
        private void destroyGUI() {
            the_URLWindow.setVisible(false);
            the_URLWindow = null;

        public void actionPerformed(ActionEvent event) {
            the_URLWindow.setVisible(true);

    class the_URLWindow extends JFrame
                            implements ActionListener {
        JTextField the_URL_Field;
        JComboBox choice;
        AppletContext appletContext;

        public the_URLWindow(AppletContext appletContext) {
            super("Show a Document!");
            this.appletContext = appletContext;

            JPanel contentPane = new JPanel(new GridBagLayout());
            setContentPane(contentPane);
            contentPane.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
            GridBagConstraints c = new GridBagConstraints();
            c.fill = GridBagConstraints.HORIZONTAL;

            JLabel label1 = new JLabel("the_URL of document to show: ",
                           JLabel.TRAILING);
            add(label1, c);

            the_URL_Field = new JTextField("http://fr.finance.yahoo.com/d/quotes.txt?m=PA&f=sl1d1t1c1ohgv&e=.csv&s=AF.PA&s=LVMH.PA", 20);
            label1.setLabelFor(the_URL_Field);
            the_URL_Field.addActionListener(this);
            c.gridwidth = GridBagConstraints.REMAINDER;
            c.weightx = 1.0;
            add(the_URL_Field, c);

            JLabel label2 = new JLabel("Window/frame to show it in: ",
                           JLabel.TRAILING);
            c.gridwidth = 1;
            c.weightx = 0.0;
            add(label2, c);

            String[] strings = {
                "(browser's choice)", //don't specify
                "My Personal Window", //a window named "My Personal Window"
                "_blank",             //a new, unnamed window
                "_self",
                "_parent",
                "_top"                //the Frame that contained this applet
            choice = new JComboBox(strings);
            label2.setLabelFor(choice);
            c.fill = GridBagConstraints.NONE;
            c.gridwidth = GridBagConstraints.REMAINDER;
            c.insets = new Insets(5,0,0,0);
            c.anchor = GridBagConstraints.LINE_START;
            add(choice, c);
              JTextField box = new JTextField("Results");
              //box.setLines(10);
              box.setColumns(100);
              c.fill = GridBagConstraints.NONE;
              c.gridwidth = GridBagConstraints.REMAINDER;
              c.insets = new Insets(5,100,100,0);
            c.anchor = GridBagConstraints.LINE_START;
            add(box, c);
            JButton button = new JButton("Show document");
            button.addActionListener(this);
            c.weighty = 1.0;
            c.ipadx = 10;
            c.ipady = 10;
            c.insets = new Insets(10,0,0,0);
            c.anchor = GridBagConstraints.PAGE_END;
            add(button, c);
        public void actionPerformed(ActionEvent event) {
            String the_URL_String = the_URL_Field.getText();
            URL the_URL = null;
            try {
                the_URL = new URL(the_URL_String);
            } catch (MalformedURLException e) {
                System.err.println("Malformed URL: " + the_URL_String);

            if (the_URL != null) {
                   box.setText(showDocument(the_URL));// *********** Java Compiler error *************
                   URLConnection conn = the_URL.openConnection();
                   BufferedReader in =
                        new BufferedReader(new InputStreamReader(conn.getInputStream()));
                        String inputLine;

                        while ((inputLine = in.readLine()) != null) {
                             System.out.println(inputLine);
                        in.close();
                   if (choice.getSelectedIndex() == 0) {
                    appletContext.showDocument(the_URL);
                } else {
                    appletContext.showDocument(the_URL,
                          (String)choice.getSelectedItem());
    }Simple but compiler error.
    If I uncomments the following lines:
                   if (choice.getSelectedIndex() == 0) {
                    appletContext.showDocument(the_URL);
                } else {
                    appletContext.showDocument(the_URL,
                          (String)choice.getSelectedItem());
                   */I get the info but the ASCII file is downloaded in my default downloads folder "/Downloads".
    Right now I have 12 dozens of files named "quotes. txt quotes-1.txt etc ... quotes-n.txt"
    correspondind to n clicks on the button. Unmanageable.
    Just want to get the following in my JTextField named "box":
    AF.PA;36,39;4/5/2007;17h35;+1,25;35,53;36,62;35,52;2547827
    LVMH.PA;84,28;4/3/2007;17h38;+1,16;83,80;84,58;83,32;1963844
    1 - If I succeed I will read the content of the JTextField - line by line - do a split(";")
    on each line to get a vector of data and finnally connect with connector/J to
    add records to a mySQL database.
    2 - If I succeed for step 1, I will create a Thread calling the stuff every 20 mn.
    This is my final objective.
    All the working and not working stuff is at http://www.edelphy.com/ShowDocumentOK/ShowDocument.html
    Please help,
    TIA
    Message was edited by: me
    dimitryous
    Message was edited by:
    dimitryous

    // expected results in the JTextField "box"
    // AF.PA;36,39;4/5/2007;17h35;+1,25;35,53;36,62;35,52;2547827
    // LVMH.PA;84,28;4/3/2007;17h38;+1,16;83,80;84,58;83,32;1963844
    import java.applet.AppletContext;
    import javax.swing.*;
    import java.awt.GridBagLayout;
    import java.awt.GridBagConstraints;
    import java.awt.Insets;
    import java.awt.event.*;
    import java.net.URL;
    import java.net.MalformedURLException;
    import java.net.URLConnection;
    import java.io.*;
    public class ShowDocument extends JApplet
                              implements ActionListener {
        the_URLWindow the_URLWindow;
        public void init() {
            //Execute a job on the event-dispatching thread:
            //creating this applet's GUI.
            try {
                SwingUtilities.invokeAndWait(new Runnable() {
                    public void run() {
                        createGUI();
            } catch (Exception e) {
                System.err.println("createGUI didn't successfully complete");
        private void createGUI() {
            JButton button = new JButton("Bring up the_URL window");
            button.addActionListener(this);
            add(button);
            JFrame.setDefaultLookAndFeelDecorated(true);
            the_URLWindow = new the_URLWindow(getAppletContext());
            the_URLWindow.pack();
        public void destroy() {
            //Execute a job on the event-dispatching thread:
            //creating this applet's GUI.
            try {
                SwingUtilities.invokeAndWait(new Runnable() {
                    public void run() {
                        destroyGUI();
            } catch (Exception e) { }
        private void destroyGUI() {
            the_URLWindow.setVisible(false);
            the_URLWindow = null;
        public void actionPerformed(ActionEvent event) {
            the_URLWindow.setVisible(true);
    class the_URLWindow extends JFrame
                            implements ActionListener {
        JTextField the_URL_Field;
        JComboBox choice;
        AppletContext appletContext;
        JTextField box;
        public the_URLWindow(AppletContext appletContext) {
            super("Show a Document!");
            this.appletContext = appletContext;
            JPanel contentPane = new JPanel(new GridBagLayout());
            setContentPane(contentPane);
            contentPane.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
            GridBagConstraints c = new GridBagConstraints();
            c.fill = GridBagConstraints.HORIZONTAL;
            JLabel label1 = new JLabel("the_URL of document to show: ",
                           JLabel.TRAILING);
            add(label1, c);
            the_URL_Field = new JTextField("http://fr.finance.yahoo.com/d/quotes.txt?m=PA&f=sl1d1t1c1ohgv&e=.csv&s=AF.PA&s=LVMH.PA", 20);
            label1.setLabelFor(the_URL_Field);
            the_URL_Field.addActionListener(this);
            c.gridwidth = GridBagConstraints.REMAINDER;
            c.weightx = 1.0;
            add(the_URL_Field, c);
            JLabel label2 = new JLabel("Window/frame to show it in: ",
                           JLabel.TRAILING);
            c.gridwidth = 1;
            c.weightx = 0.0;
            add(label2, c);
            String[] strings = {
                "(browser's choice)", //don't specify
                "My Personal Window", //a window named "My Personal Window"
                "_blank",             //a new, unnamed window
                "_self",
                "_parent",
                "_top"                //the Frame that contained this applet
            choice = new JComboBox(strings);
            label2.setLabelFor(choice);
            c.fill = GridBagConstraints.NONE;
            c.gridwidth = GridBagConstraints.REMAINDER;
            c.insets = new Insets(5,0,0,0);
            c.anchor = GridBagConstraints.LINE_START;
            add(choice, c);
              box = new JTextField("Results");
              //box.setLines(10);
              box.setColumns(100);
              c.fill = GridBagConstraints.NONE;
              c.gridwidth = GridBagConstraints.REMAINDER;
              c.insets = new Insets(5,100,100,0);
            c.anchor = GridBagConstraints.LINE_START;
            add(box, c);
            JButton button = new JButton("Show document");
            button.addActionListener(this);
            c.weighty = 1.0;
            c.ipadx = 10;
            c.ipady = 10;
            c.insets = new Insets(10,0,0,0);
            c.anchor = GridBagConstraints.PAGE_END;
            add(button, c);
        public void actionPerformed(ActionEvent event) {
            String the_URL_String = the_URL_Field.getText();
            URL the_URL = null;
            try {
                the_URL = new URL(the_URL_String);
            } catch (MalformedURLException e) {
                System.err.println("Malformed URL: " + the_URL_String);
            if (the_URL != null) {
                   box.setText("Hellooooooooooo");// *********** Java Compiler error *************
              try{     
                   URLConnection conn = the_URL.openConnection();
                   BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
                        String inputLine;
                        while ((inputLine = in.readLine()) != null) {
                             System.out.println(inputLine);
                        in.close();
              } catch (Exception e) {
                   e.printStackTrace();
                   if (choice.getSelectedIndex() == 0) {
                    appletContext.showDocument(the_URL);
                } else {
                    appletContext.showDocument(the_URL,
                          (String)choice.getSelectedItem());
    }Create a HTML page as
    <HTML>
    <HEAD>
    <TITLE>ShowDocument</TITLE>
    </HEAD>
    <BODY>
    <H1>ShowDocument</H1>
    <BR>
    <APPLET CODE="ShowDocument" WIDTH=600 HEIGHT=50>
    If you can see this, your browser does not support Java applets.
    </APPLET>
    </BODY>
    </HTML>

  • Simple passing ball applet! HELP

    Absolutely a beginner and in need of a bit of help/guidance plz!!!
    trying to design a simple game with 2 players who pass a ball between one-another. Once the ball has been passed the player without/ or both players (which ever is simplier) must randomly move to another point in the applet before the next pass. The ball during the pass must move directly to the other player. Every pass adds 1 point to the score. Once score = 5 game finished.
    The ball should never bounce around the applet. and there should be no involvement from the user.
    cheers
    soupss

    differnt to pong in fact that players move all over applet and ball does not move around applet freely.
    graeme

Maybe you are looking for

  • How do I install latest version of Adobe Acrobat Reader?

    I am unable to open two electronic messages from my bank.  They suggested I install the latest verson of Adobe Acrobat Reader.  How do I do that?

  • Comprehensive overview/question about organizing videos and movies

    I've made a few movies here and there in the original iMovie, have made a fair amount of home movies using FCE. I have 20 years worth of videos scattered around on HI-8 formatting and some videos I downloaded from a hand held digital cheapo-movie cam

  • ADE 2.0 does not open 'older' ACSM files

    I found many questions/help requests re opening ACSM files -- but none like this. I have a number of ACSM files that are several years old and I no longer have data re where/how they were obtained.  I recently lost the 'My Digital Editions' folder bu

  • I forgot to change the country when buying things at apple store.

    I ordered a speck seethru satin case from apple store on the 20th of August, but I forgot to change the country, so the shipping address is in US, while I'm staying in Malaysia. So what should I do know to get the case?

  • Satellite A660-18N hanging and needs hard reboot

    My Satellite A660-18N hangs every other day about 2/3 times. I cannot press ctrl + alt + del and the mouse does not move. I have to hold down the power button to reboot it manually. It started about 2 weeks after I got it which was in September. I wa