liveHarmony plain logo
Service update liveHarmony to discontinue service as of August 1, 2011. See home page for details.

Customizing chat applets

The Java chat applet has many customizable options -- you can change size, colors, fonts, and much more. This guide will help you create a unique chat applet for your site that matches your site's atmosphere.

Our code generator uses JavaScript to set various options for the chat environment. By changing this script, you can easily set parameters on how the applet looks and works. This is done by specifying the name of the parameter to customize, and a new value for that parameter. For example, the parameter with name simple can have either of two values -- true if you'd like to present the simple chat applet, or false for the advanced version. Other parameters like height can have one of many possible values -- in this case, the value represents a number of pixels depending on how large you would like the applet to be. Note that only code generated with our "advanced" option is customizable; if you are using an lhcw.net web page, your code cannot be customized at this time.

To set an option, edit the HTML source of your chat page. In the code, you will find a section marked "customizable" that looks like the following:

(Please note that this code is abridged. To generate full code, please visit our code generator)

  // *** begin customizable section ***
  // *** for more information, see www.liveharmony.org ***
  ['simple', 'false'],
  ['width', '500'],
  ['height', '350'],
  ['fg', '000000'],
  ['bg', 'FFFFFF'],
  // *** end customizable section ***
  ['__blank', 'blank']

The above code shows a few parameters already set with example values -- simple has been set to false, width to 500, and so forth. To change a parameter that's already listed, simply edit the value on that line. To add a new parameter and its value, add a new line after the existing parameters with the form:

  ['name', 'value'],

Each parameter should be on its own line, somewhere between the "begin customizable section " and "end customizable section" lines, otherwise it may cause script errors. Keep in mind that the name-value pairs form a list, so each parameter line (except for the last) should end with a comma, as above. Also note that you'll need to put single quotes around the parameter names and values for the applet to function properly -- not double quotes as with HTML tags. Due to the way JavaScript handles text, if you want to put an apostrophe, single-quote, or backslash into a parameter, you'll need to put a backslash before it to ensure that it is interpreted correctly. (Yes, this means that if you want a backslash in the parameter, you'll need to insert two backslashes.) For example, to set the parameter ticker1 (which displays a scrolling message on the bottom of the applet) to Welcome to Fred's Chat Room!, insert the following code:

  ['ticker1', 'Welcome to Fred\'s Chat Room!'],

Common parameters

These are some of the settings you can change for your applet:

Changing fonts

To change the font that the applet uses, modify the font and size parameters.

Java supports three basic fonts: serif, sans serif, and monospace. Serif fonts have extra strokes at the ends of lines that make them easier to read; sans serif fonts do not have these and may look "cleaner" but less readable. Monospace fonts will look like the output of a typewriter, where each letter takes the same amount of space, regardless of its actual width. A font's size is specified in points (equal to 1/72 in.); 12 to 14 points is generally an optimal size for most web users. Note that the parameter value for a sans serif font is 'sansserif', with no space.

To set a serif font, use the following code:

  ['font', 'serif'],
To set the font size to 11, use the following code:
  ['size', '11'],

Changing colors

You can set the foreground color of your applet with the fg parameter:
  ['fg', '000000'],
Similarly, you can set the background color with the bg parameter:
  ['bg', 'FFFFFF'],
These parameters use HTML-style color codes (without the leading #), which you can copy from your page's HTML code to preserve a uniform color scheme. You can also generate HTML color codes with any HTML editor, or reference a chart online. You can fine-tune your applet's colors with other parameters not listed here (see "Changing other settings" below).

Disabling sounds

By default, users can select actions from a drop-down menu to send a line of text and play a sound. To disable this, change the playsounds and sounds parameters:
  ['playsounds', 'false'],
  ['sounds', 'Not available;null'],

To reenable sounds, set playsounds to true and remove the sounds parameter:

  ['playsounds', 'true'],

Enabling the button panel

The button panel is a set of buttons displayed above the interface that allows access to session options and a rooms list. To enable it, set showbuttonpanel to true:

  ['showbuttonpanel', 'true'],

To disable it, set showbuttonpanel to false:

  ['showbuttonpanel', 'false'],

Changing other settings

Our software provider, WebMaster, has compiled an extensive list of customizable parameters (opens in a new window). They also have an addendum with detailed guicolors options.



Back to top

CHAT NOW!
Learn about chat room safety
© 2002-2008 liveHarmony. Portions of this work are licensed under a Creative Commons license