DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2006
    Posts
    3

    Question applet problem:(

    i will say hi because this my first post

    i know this:

    -------------------------------------------------------------------
    //applet.java

    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;

    public class applet extends JApplet {
    JTextArea ta = new JTextArea(10,30);
    public applet() {
    }
    public void init() {
    Container p = getContentPane();
    p.setLayout(new FlowLayout());
    p.add(ta);
    }
    public void start() {
    }
    public void stop() {
    }
    public void destroy() {
    }

    }
    -----------------------------------------------------------------
    //manifest.txt
    Main-Class: applet
    -----------------------------------------------------------------
    //applet.html
    <HTML>
    <HEAD>
    <TITLE>Applet Test Page</TITLE>
    </HEAD>
    <BODY>
    <APPLET CODE = "applet.class" ARCHIVE = "applet.jar" NAME = "%s" WIDTH = 400 HEIGHT = 300 ALIGN = middle>
    </APPLET>
    </BODY>
    </HTML>
    ------------------------------------------------------------

    now:
    javac applet.java
    jar cfm applet.jar manifest.txt *.class
    HTMLconverter applet.html

    and it works
    but i got problem with packages (true applet code is bigger but idea the same)

    i make 2 java file:
    -------------------------------------------------------------------
    //applet.java
    package pack;

    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;

    public class applet extends JApplet {
    JTextArea ta = new JTextArea(10,30);
    public applet() {
    }
    public void init() {
    Container p = getContentPane();
    be b=new be();
    p.setLayout(new FlowLayout());
    p.add(ta);
    }
    public void start() {
    }
    public void stop() {
    }
    public void destroy() {
    }

    }
    -----------------------------------------------------------------
    //be.java
    package pack;

    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;

    public class be{
    public be(){
    }
    }
    --------------------------------------------
    //manifest.txt
    Main-Class: pack.applet
    -----------------------------------------------------------------
    //applet.html
    <HTML>
    <HEAD>
    <TITLE>Applet Test Page</TITLE>
    </HEAD>
    <BODY>
    <APPLET CODE = "applet.class" ARCHIVE = "applet.jar" NAME = "%s" WIDTH = 400 HEIGHT = 300 ALIGN = middle>
    </APPLET>
    </BODY>
    </HTML>
    ------------------------------------------------------------

    now:
    javac *.java
    jar cfm applet.jar manifest.txt *.class
    HTMLconverter applet.html

    and it dont work pls help me

  2. #2
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    I don't know how much this might relate to your project, but you may have a naming conflict. Java already has a package "applet", and a class "Applet".

    Try changing the names of your package and class and run things again. Any difference?

Similar Threads

  1. Replies: 0
    Last Post: 03-22-2006, 02:17 AM
  2. Josephus Problem, problem.
    By aesoprock00 in forum Java
    Replies: 2
    Last Post: 01-28-2006, 06:18 PM
  3. JavaMail applet problem
    By Tataroz T. in forum Java
    Replies: 1
    Last Post: 10-20-2005, 06:19 AM
  4. help needed on java program problem, please
    By Paul McCaffery in forum Java
    Replies: 0
    Last Post: 11-21-2002, 05:24 PM
  5. Problem with Applet and Buttons - Please help!
    By John Syrakis in forum Java
    Replies: 0
    Last Post: 11-09-2000, 04:11 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links