I just updated to j2sdk1.4 from 1.3.
All paths are correct I can compile servlets, applets and standalones.
But When I attemp to view newly compiled Applets I get class StringViewer not found error in my browser status bar..
Here is the html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> Writing Test Applets </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<p align=center>
<applet code="StringViewer2" width=100 height=50>
<PARAM NAME="timer" value="50">
<PARAM NAME="viewer" value="Hi there its tuesday">
</applet>
</BODY>
</HTML>
Here is the applet which works fine untill I recompile it with 1.4 ( I do not get any compile errors and the compiled class appears in the same directory after I compile it:
import java.applet.Applet;
import java.awt.*;
import java.util.StringTokenizer;
import java.lang.reflect.Array;
public class StringViewer extends Applet implements Runnable{
String timer, viewer;
String buffer[];
int y_position[];
int startOver;
Thread Me;
public void init(){
timer = null;
viewer = null;
try{
if (getParameter("timer"
!= null){
timer = getParameter("timer"
;
} else{
timer = "1000";
}
if (getParameter("viewer"
!= null){
StringTokenizer viewer = new StringTokenizer(getParameter("viewer"
);
startOver = viewer.countTokens();
buffer = new String[startOver];
y_position = new int[startOver];
int advancing = 55;
for (int i = 0; i < startOver; i++){
buffer = viewer.nextToken();
y_position = advancing;
advancing = advancing + 20;
}
} else {
viewer = "No applet string input";
}
} catch (Exception e){
System.out.println("input parameters not excepted"
;
}
}
public void start(){
if (Me == null){
Me = new Thread(this);
Me.setPriority(Thread.MIN_PRIORITY);
Me.start();
}
}
public void run(){
//String word[] = new String[4];
while (Me != null){
try{
Me.sleep(Integer.parseInt(timer));
if (y_position[Array.getLength(y_position) - 1] < 0){
int cycle = 65;
for (int x = 0; x < startOver; x++){
y_position[x] = cycle;
cycle = cycle + 20;
}
}else{
for (int y = 0; y < startOver; y++){
y_position[y] = y_position[y] - 1;
}
}
}catch (InterruptedException e){
System.out.print("error in string"
;
}
repaint();
}
}
public void stop(){
if (Me != null && Me.isAlive()){
//Me.stop();
Me = null;
repaint();
}
//addItem("stopping...."
;
}
public void destroy(){
Me = null;
}
public void paint(Graphics g){
g.drawRect(0,0, getSize().width -1, getSize().height -1);
g.setFont( new Font("Serif", Font.BOLD + Font.ITALIC, 20));
g.setColor( Color.red);
for (int k = 0;k < startOver ; k++){
g.drawString(buffer[k].toString(), 15, y_position[k]);
}
}
}
Any help would be greatly appreciated
Thanks in advance,
Bygs![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
All paths are correct I can compile servlets, applets and standalones.
But When I attemp to view newly compiled Applets I get class StringViewer not found error in my browser status bar..
Here is the html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> Writing Test Applets </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<p align=center>
<applet code="StringViewer2" width=100 height=50>
<PARAM NAME="timer" value="50">
<PARAM NAME="viewer" value="Hi there its tuesday">
</applet>
</BODY>
</HTML>
Here is the applet which works fine untill I recompile it with 1.4 ( I do not get any compile errors and the compiled class appears in the same directory after I compile it:
import java.applet.Applet;
import java.awt.*;
import java.util.StringTokenizer;
import java.lang.reflect.Array;
public class StringViewer extends Applet implements Runnable{
String timer, viewer;
String buffer[];
int y_position[];
int startOver;
Thread Me;
public void init(){
timer = null;
viewer = null;
try{
if (getParameter("timer"
timer = getParameter("timer"
} else{
timer = "1000";
}
if (getParameter("viewer"
StringTokenizer viewer = new StringTokenizer(getParameter("viewer"
startOver = viewer.countTokens();
buffer = new String[startOver];
y_position = new int[startOver];
int advancing = 55;
for (int i = 0; i < startOver; i++){
buffer = viewer.nextToken();
y_position = advancing;
advancing = advancing + 20;
}
} else {
viewer = "No applet string input";
}
} catch (Exception e){
System.out.println("input parameters not excepted"
}
}
public void start(){
if (Me == null){
Me = new Thread(this);
Me.setPriority(Thread.MIN_PRIORITY);
Me.start();
}
}
public void run(){
//String word[] = new String[4];
while (Me != null){
try{
Me.sleep(Integer.parseInt(timer));
if (y_position[Array.getLength(y_position) - 1] < 0){
int cycle = 65;
for (int x = 0; x < startOver; x++){
y_position[x] = cycle;
cycle = cycle + 20;
}
}else{
for (int y = 0; y < startOver; y++){
y_position[y] = y_position[y] - 1;
}
}
}catch (InterruptedException e){
System.out.print("error in string"
}
repaint();
}
}
public void stop(){
if (Me != null && Me.isAlive()){
//Me.stop();
Me = null;
repaint();
}
//addItem("stopping...."
}
public void destroy(){
Me = null;
}
public void paint(Graphics g){
g.drawRect(0,0, getSize().width -1, getSize().height -1);
g.setFont( new Font("Serif", Font.BOLD + Font.ITALIC, 20));
g.setColor( Color.red);
for (int k = 0;k < startOver ; k++){
g.drawString(buffer[k].toString(), 15, y_position[k]);
}
}
}
Any help would be greatly appreciated
Thanks in advance,
Bygs