DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2002

    Angry text not appearing in applet

    the following program compiles and runs but the text does not appear in the applet after appletviewer command,

    import java.awt.Container;
    import java.swing.*;

    public class SquareInt extends JApplet {
    public void init() {
    String output = " ";

    JTextArea outputArea = new JTextArea (10, 20);

    Container c = getContentPane();


    int result;

    for (int x = 0; x <= 10; x++) {
    result = square(x);
    output += "The square of " + x + "is " + result + "\n";

    outputArea .setText(output);

    public int square(int y) {
    return y * y;


    // Square.html

    <TITLE> This is a simple program </TITLE>
    Here is the output of my program:
    <APPLET CODE = "SquareInt.class" WIDTH = 60 HEIGHT = 40 >

    "C How To Program" 3rd edit., Deitel & Deitel, page 896 & 897

  2. #2
    Join Date
    Oct 2002

    Unhappy found error

    found error in the code. on my pc i had Init() and not init(). init () is a method and not a class so init() is the correct name. seemed to have written it correctly in my post although i had it wrong on my pc. sorry for the mislead and thanks to all who tried to fix the code.

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
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.