This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Applets and the fly likes multithreading issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "multithreading issue" Watch "multithreading issue" New topic

multithreading issue

R. Aw

Joined: Feb 02, 2008
Posts: 4
I cant get my banner text to show up in my applet only the calculator shows do i need to add a label and display the rotating text in the labels, instead of using the drawString(). if so, how do i do this?

here is my code:

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.applet.*;

<applet code="SimpleBanner" width=350 height=100>

public class SimpleBanner extends Applet implements Runnable {
String msg = " Say YES to Multi-threading ";
Thread t = null;
Thread threadCal = null;
int state;
boolean stopFlag;
Calc c = new Calc();
Panel p1 = new Panel();
Panel p2 = new Panel();

/*In the SimpleBanner class, add a label and display
the rotating text in the labels, instead of using the drawString().*/

// Set colors and initialize thread.
public void init() {

setLayout(new GridLayout(2, 1));

p2.setLayout(new GridLayout(1,1));


// Start thread
public void start() {
t = new Thread(this);
threadCal = new Thread();
stopFlag = false;

// Entry point for the thread that runs the banner.
public void run() {
char ch;

// Display banner
for( ; ; ) {
try {
ch = msg.charAt(0);
msg = msg.substring(1, msg.length());
msg += ch;
} catch(InterruptedException e) {}

// Pause the banner.
public void stop() {
stopFlag = true;
t = null;

// Display the banner.
public void paint(Graphics g) {
g.drawString(msg, 20, 30);
} //public class SimpleBanner extends Applet implements Runnable {
subject: multithreading issue
It's not a secret anymore!