applet is not displayed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shooric
    New Member
    • Jul 2007
    • 2

    applet is not displayed

    Ive written my first web page using java and html. When i run the applet from my local file, internet explorer opens up and runs html text plus the applet.BUT, when uploaded my files to my friends server to see how the page will like on online, the Text is displayed, but the APPLet is not. I've included java code and html.
    Thank You.

    [code=html]
    <html>
    <head>
    <title>fahrenhe it and centigrade</title>
    </head>
    <body>
    <h1><center>fah renheit and centigrade temperatures</center></h1>
    Enter temperture in <i>fahrenheit </i> press convert to get tempture in <i>centigrade
    <p>
    <applet code=TempConver ter.class"WIDTH =300 HEIGHT=150></applet>
    <p>
    <a href="http://www.soundskool. com">click here for dj website</a>
    </body>
    </html>
    [/code]

    [code=java]
    import javax.swing.*;
    import java.awt.*;
    import java.text.Decim alFormat;
    import java.awt.event. *;

    public class TempConverter extends JApplet
    {
    private JPanel fPanel;
    private JPanel cPanel;
    private JPanel buttonPanel;
    private JTextField fahrenheit;
    private JTextField centigrade;
    public void init()
    {
    buildFpanel();
    buildCpanel();
    buildButtonPane l();

    setLayout(new GridLayout(2,0) );
    add(fPanel);
    add(cPanel);
    add(buttonPanel );
    }
    private void buildFpanel()
    {
    fPanel=new JPanel();

    JLabel message1=new JLabel("fahrenh eit");

    fahrenheit=new JTextField(10);
    fPanel.setLayou t(new FlowLayout(Flow Layout.RIGHT));
    fPanel.add(mess age1);
    fPanel.add(fahr enheit);
    }
    private void buildCpanel()
    {
    cPanel=new JPanel();
    JLabel message2=new JLabel("centigr ade");

    centigrade=new JTextField(10);

    centigrade.setE ditable(false);

    cPanel.setLayou t(new FlowLayout(Flow Layout.LEFT));

    cPanel.add(mess age2);
    cPanel.add(cent igrade);
    }
    private void buildButtonPane l()
    {
    buttonPanel=new JPanel();

    JButton button=new JButton("Conver t");

    button.addActio nListener(new ButtonListener( ));
    cPanel.add(butt on);
    }
    private class ButtonListener implements ActionListener
    {
    public void actionPerformed (ActionEvent e)
    {
    double ftemp,ctemp;

    DecimalFormat formatter=new DecimalFormat(" 0.0");

    ftemp=Double.pa rseDouble(fahre nheit.getText() );

    ctemp=(5.0/9.0)*(ftemp-32);
    centigrade.setT ext(formatter.f ormat(ctemp));
    }
    }
    }
    [/code]
    Last edited by JosAH; Jul 20 '07, 02:37 PM. Reason: added a few [code=...] ... [/code] tags
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Is any error message shown? Check also to see if your friend's browser has applets enabled.
    Last edited by r035198x; Jul 21 '07, 07:34 AM. Reason: friend

    Comment

    Working...