Any idea how I can make a applet using a thread and how i will implement it..SOS..

Dani AI

Generated

Short practical guidance for an applet + thread project, plus safe modern context.

Applet status and testing: applets are now effectively obsolete for web deployment because mainstream browsers dropped the Java plugin. For coursework that still asks for an applet, use a local test tool (AppletViewer) or build the same UI as a standalone Swing window instead. ’s pointer to tutorials is useful for syntax and lifecycle basics, but treat browser security/plugin support as a separate deployment concern.

Project ideas (balanced difficulty)

  • Start: a simple animated circle (echoing ). Add controls (start/stop, speed) and collision with window edges. This teaches threads, repainting and basic geometry.
  • Medium: a graphing calculator (based on ). Let background threads evaluate function samples (one thread per function or a small pool), store results in a shared model, then repaint on the UI thread. Add pan/zoom, multiple colored plots, and error handling for bad expressions.
  • Advanced: producer/consumer demo (data generator thread + rendering thread), or a small simulation (particles, Boids) where each agent runs in its own update loop and a coordinator handles rendering.

Threading rules and gotchas

  • Never update Swing components off the Event Dispatch Thread (EDT). Use SwingUtilities.invokeLater or SwingWorker for background work that updates the UI.
  • Avoid Thread.sleep on the EDT. Use javax.swing.Timer for simple periodic UI updates.
  • Use a volatile boolean or interrupts to stop threads cleanly; synchronize access to shared models or use java.util.concurrent utilities.
  • Use double-buffering or draw into an offscreen BufferedImage when plotting many points to avoid flicker.

Minimal pattern (compute off-EDT, update UI on-EDT):

class ComputeTask implements Runnable {
  private volatile boolean running = true;
  public void run() {
    while (running) {
      List<Point> pts = computePoints();
      SwingUtilities.invokeLater(() -> { model.setPoints(pts); panel.repaint(); });
      try { Thread.sleep(50); } catch (InterruptedException e) { break; }
    }
  }
  public void stop() { running = false; }
}

These patterns keep the UI responsive and fit the "not too simple / not too hard" project goal.

Recommended Answers

All 10 Replies

by writing the code and running it?

Or Google and copy and paste.

by wrting code and running it..:) because we have a project and i am confuse..not to simple but not also hard..

we're not here to do your homework for you. If you had done your homework in the past, you'd have known what to do now.

Just only idea not code...getz?..

yes, you are right

Just only idea not code

What do you want the applet to do?
Write the program in small steps.
Why don't you write a simple applet the draws a circle on the screen. There are many examples of how to do that posted here on the forum.
When you get that to work, then add a thread that will move the circle around.

make a graph calculator. use graphics and then get the user to type in a valid expression. then calculate the y points for the x values and graph it. This will let yo use graphics and arrays. You will also use Math class. It will be interesting especially if you make a vector of arrays that hold the y vales for the x and then you color code them and print them all out. Then you could compare graphs. You would also have too clear the screen once in a while. This would be a great teaching tool. You know what ... Thanks for the idea (lol (JK :P))

Thanks for the idea I will try it if our professor will approve it..:D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.