John Young

Greenhorn
+ Follow
since Jan 12, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by John Young

does anyone know where i can find a webpage with the (r,g,b) values of colors instead of me testing various values to see what colors I get???
Thanx
20 years ago
how do I set the font color of text instead of using

is there anyway of including it in the following line
??
20 years ago
Hi,
Me again! was just wondering if anyone knows if theres a way that you can stop people editing java files because I downloaded some java files to write a chat applet and any alterations I have made - layout, strings etc - have not taken effect when recompiled! P L E A S E H E L P!!!
J.Y.
20 years ago
when i put my applet onto webpage it doesnt display and gives the following error java.lang.NoClassDefFoundError:javax/swing/JApplet
could someone tell me what it means and how to fix it
thanx
20 years ago
getting this error: rror:java.lang.NoClassDefFoundError:javax/swing/JApplet
what does this mean?
20 years ago
em ok, thanx for advise. New to this so gimme a bit of time and I'll be a perfect poster!
20 years ago
obviously that wink wasnt supposed to come out in the middle of the code, its because it supposed to be
for(;; then another )
20 years ago
thanx a mill - sorted out now!
Now having a problem with my applet server - keeps on giving a runtime error: due (I think!)to the following line:
clientList = new JList();
in the AppletServer() method.
Its driving me mad(PLEASE HELP!) - I swear I'm not stupid!

Heres my AppletServer code

import java.net.*;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.*;
import java.util.*;
import javax.swing.*;
public class AppletServer extends Thread
{
protected final static int defaultPort = 1976;
protected int paramPort;
protected ServerSocket server;
protected ThreadGroup tg;
protected JList clientList; //ambiguous
protected Vector clientVector;
protected Watcher watcher;
public static void main (String [] args)
{
System.out.println("The Chat Server is running");
int port = -1;
boolean background = true;
if(args.length == 0)
{ new AppletServer();
}
else if (args.length == 1)
{
if(args[0].equals(" -f"))
{
background = false;
new AppletServer(background);
}
else
{ try
{
port = Integer.parseInt(args[0]);
new AppletServer(port, background);
}

catch(NumberFormatException e)
{
System.out.print("not a valid port number");
System.out.println("use and inteer over 1024");
System.out.println(e);
System.out.println();
System.out.print("Starting sever on "+ defaultPort);
new AppletServer();
}
}
}
else if ( (args.length == 2) && args[0] == "-f")
{
background = false;
try
{
port = Integer.parseInt(args[0]);
new AppletServer(port, background);
}
catch(NumberFormatException e)
{
System.out.print("not a valid port number");
System.out.println("use and intsert over 1024");
System.out.println(e);
System.out.println();
System.out.print("Starting sever on "+ defaultPort);
new AppletServer();
}
}
else
System.out.println("usage: java AppletServer [-f] [<port_#>]");
}

public AppletServer()
{
super(); //create thread
try
{
server = new ServerSocket(defaultPort);

}
catch(IOException e)
{
System.out.println("could not create ServerSocket");
System.out.println(e);
System.exit(1);
}

tg = new ThreadGroup("Connections");
clientList = new JList();
clientVector = new Vector();
watcher = new Watcher(this);
this.start();
}
public AppletServer(boolean background)
{
super(); //create thread
try
{
server = new ServerSocket(defaultPort);
}
catch(IOException e)
{
System.out.println("could not create ServerSocket");
System.out.println(e);
System.exit(1);
}
tg = new ThreadGroup("Connections");
clientList = new JList(); //ambiguous
clientVector = new Vector();
watcher = new Watcher(this);
this.start();

Frame f = new Frame("AppletServer Monitor");
f.add("Center", clientList);
f.setSize(400, 300);
f.show();
this.start();
}
public AppletServer(int port, boolean background)
{
super(); //create thread
try
{ server = new ServerSocket(port);
}
catch(IOException e)
{
System.out.println("could not create ServerSocket");
System.out.println(e);
System.exit(1);
}
tg = new ThreadGroup("Connections");
clientList = new JList(); //ambiguous
clientVector = new Vector();
watcher = new Watcher(this);
Frame f = new Frame("AppletServer Monitor");
f.add("Center", clientList);
f.setSize(400, 300);
f.show();
this.start();
}
public void run()
{ try
{ for(;
{
Socket client = server.accept();
ClientConnect cc = new ClientConnect(this, client, tg, watcher);
synchronized(clientVector)
{
clientVector.addElement(cc);
//clientList.add(cc.toString());
clientList = new JList(clientVector);
}
}
}
catch(IOException e)
{
System.out.println("error accepting connections");
System.out.println(e);
System.exit(1);
}
}
}
20 years ago
Trying to make a chat room. Having a problem with my action method (JDK1.1) in my ChatApplet class Am after converting all the files from 1.1 to 1.3 and had no problems til I came across this warning after changing some of the lines in the method.

"action(java.awt.Event,java.lang.Object) in java.awt.Component has been deprecated"
Here's my method:

public boolean action(Event e, Object o)
{
if ((e.target == send) && (e.arg !=""))
{ if (newbie == true)
{ msgs.append("You must first connect to the server. \n");
msgs.append("Please type your name and press connect.\n");
writemsg.requestFocus();
}
else
{ send(writemsg.getText() );
writemsg.setText("");
writemsg.requestFocus();
return true;
}
}
else if (e.target == connect)
{ if(newbie == true)
{ connect();
newbie = false;
name = writemsg.getText();
writemsg.setText("");
writemsg.requestFocus();
msgs.setText("Begin chatting. \n");
}
else
{ msgs.append("already connected!\n");
return true;
}
}
else if (e.target == disconnect)
{ stop();
newbie = true;
msgs.setText("enter your name and press connect \n");
writemsg.requestFocus();
return true;
}
return false;
}
Any help would be appreciated!
20 years ago