• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Applet is not visible.

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
import java.applet.Applet;
import java.awt.Graphics;


public class Test extends Applet {

StringBuffer buffer;

public void init() {
buffer = new StringBuffer();
addItem("initializing... ");
}

public void start() {
addItem("starting... ");
}

public void stop() {
addItem("stopping... ");
}

public void destroy() {
addItem("preparing for unloading...");
}

private void addItem(String newWord) {
System.out.println(newWord);
buffer.append(newWord);
repaint();
}

public void paint(Graphics g) {

g.drawRect(0, 0,
getWidth() - 1,
getHeight() - 1);


g.drawString(buffer.toString(), 5, 15);
}
}


when I run this applet (Run-as java Applet) from eclipse nothing Appears Why? please Expalin .
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Punya,

This thread doesn't really belong in the Threads forum, I don't think. I am moving it to the more appropriate Applet forum.

Also, as I noted in your last thread - please use Code tags to make the code more readable. You can edit your post by pressing the Edit button in the top right corner of the post, and then add the code tags by selecting the code and pressing the Code button at the top of the editor. You can also manually enter the code tags by putting [code] at the start of the code and [\code] at the end.
 
Punya Pratap Singh
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your suggestion Steve,I will take care of It for my further Posts ..
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Punya Pratap Singh wrote:Thanks for your suggestion Steve,I will take care of It for my further Posts ..


Why not take care of it for this post? Leaving the code unformatted after Steve's suggestion just implies you don't think it is important.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looking at your code, it should work fine (as far as it goes.) I don't know about this "Run as applet" option in Eclipse, though -- how does it know the dimensions to use for the applet? Perhaps it's too small, so you're not seeing anything?
 
reply
    Bookmark Topic Watch Topic
  • New Topic