LanguagesSo, You Want A Chat Room, Huh?

So, You Want A Chat Room, Huh? content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

     To the reader: This is a new chatroom tutorial I wrote to replace the last one. That one was way out of date. What you have here is the applet tutorial I wrote to go in the HTML Goodies book. It just happens to be a chatroom applet, so I was lucky that the tutorial that went way out of date could be easily replaced with a book tutorial. So, follow along with this new chatroom tutorial and happy chatting. Enjoy it…

     This tutorial deals with Java Applets. The purpose of this tutorial is to get acquainted with an applet, how to get it on your page, and how you can get chatting.

     I won’t be going into actually how to write the Java programming language because you have to either be an Einstein-level genius, have gobs of free time, or be from the planet Vulcan to understand it. I tried so hard to get a handle on this language, but it is devilishly hard and scares me. So, I do what the vast majority of people using the Web do — I use other people’s applet creations.

     I see applets handed out basically one of two ways. Either the applet sits on the creator’s server and you attach to it or the applet is given right to you and you place it on your own server. We’ll go over attaching to an applet on another server here. It’s a very nice deal. Their server does all the work and you get the effect.

     The applet we’ll work with here is a very cool one. You’ll be able to use it to do real-time chats with other people all over the Web. Plus, it won’t make your own server people angry, because all the work will be done somewhere else. For some other real-time chat options, check here: So, You Want to Pow Wow, Huh?

Getting The Chat Room Applet

     Here’s the process we’ll follow. The chatroom applet is being offered to you through the fine people at Chat Planet, the largest Java Chat site on the Internet ( They know I am including this tutorial and have given me full permission to do so.

     What you’ll do is go to the Chat Planet site by clicking the link above and choose the link that reads “Get Chat For Your Site.” There you’ll be asked a bunch of questions including your name and your age plus a few other not-so-delving queries including what the title of the page will be you intend to use the applet on and what the topic of chat will be.

     You’ll be given the ability to choose five different interfaces (graphical looks) for your chat room. You’ll submit all of this and bingo, you’ll get back some code to place on your page that will run the applet right from the Chat Planet server. The entire process took me less than two minutes, but I type fast. Once all is right with Chat Planet, you receive your code, and the applet is up and running.

     I should say here that if you really like the applet, there is a way you can download and run it right from your own server, but you’ll need to read an Advanced Java Tutorial to understand how to do that.

The Code I Got

     After I submitted all the information Chat Planet wanted, I received this in my e-mail box about an hour later:

CODE=”” WIDTH=”640″ HEIGHT=”400″>
<PARAM NAME=”access” VALUE=”public”>
<PARAM NAME=”channel” VALUE=”HTML Goodies”>
<PARAM NAME=”host” VALUE=””>
<PARAM NAME=”port” VALUE=”5030″>
<PARAM NAME=”style” VALUE=””>

What Does It All Mean?

     If this is the first time you’ve seen an applet’s code then it might look a little goofy, but it all works to help the applet run correctly. I should say here that this code will not work if you simply transcribe it to your page right from here. This code was created just for me. You have to go and have code created for you.

     Let’s look at the main APPLET command first:


Here’s What’s Happening:

  • APPLET tells the browser that it will now have to contend with an applet.

  • CODEBASE denotes the name of a directory on the server where all the applets are held. You see, when you sign up with Chat Planet, an applet is created just for you. After it’s created, it’s placed in a directory. In this case the direct URL to the directory is:

  • CODE tells the browser which file inside the directory to use. I keep this straight by thinking of CODE as an equal to “SRC” in an image command. In this case I am using an applet called Note the “class” after the dot.

  • WIDTH and HEIGHT define parameters in which the applet can work. You have to have this. Applets work inside their one little window. The height and width settings define the window. Some applets allow you to change the height and width. This one does not. Go with the sizes you are sent.

Now, the Applet’s Parameters

Immediately under the main applet command comes all the commands. These are commands that set parameters allowed by the applet. Keep in mind that every applet is unique. It is up to the author whether to allow you to alter parameters or not. Just because a parameter setting works in one applet is no guarantee it will work in another. Here, there are five parameter settings:

<PARAM NAME=”access” VALUE=”public”>
<PARAM NAME=”channel” VALUE=”HTML Goodies”>
<PARAM NAME=”host” VALUE=””>
<PARAM NAME=”port” VALUE=”5030″>
<PARAM NAME=”style” VALUE=””>

Each setting has three commands:

  • PARAM denotes the parameter
  • NAME denotes the name of the parameter
  • Value is the parameter setting.

     If you read through the parameter settings above you’ll note that this applet is open to the public. It’s to be used on HTML Goodies, the host is People will attach through port 5030 and no style value is set.

     Now, can you change these parameters? No. They’re pretty well set. But that doesn’t mean you can’t change any parameters. When we install our own applet, you’ll be able to change parameters to your heart’s content.

     Finally, the end applet command ends the entire deal.

     When you call for the page in your browser, the applet should download into the browser, run, and post the chatroom on your page for all to use.

Gray Box!

     It is possible you’ll get a big gray box where the applet should be. That could mean you have altered the code, which you shouldn’t be doing anyway, or the applet server is down. These things happen. Give the people in charge a little time and they’ll get it up and running again soon. Believe me, they know it’s not working. I’ve been in a server house when someone kicked the plug out my mistake. It is total mayhem.

     Let me tell you also that it takes a solid amount of time, like two weeks to a month, to get your chatroom up and working after you sign up. This is a popular site and it’ll take a bit of time to get it all straight. Be patient. You’ll be chatting soon enough.

Is That It?!

     Yup. That’s it. The applet should run just fine. I’ve gotten this pup to work and you can, too. The applet downloads, then runs like the little program that it is… and you’re chatting.


Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories