Mitzrah's Get IT Right Column!!
JAVA Applet - On/Off Pressable Buttons
Updated : Friday, August 07, 1998

Mitzrah's Get IT Right Column!

Hallo there!

This is another cool JAVA applet which I am always thinking of using but have not found the reason to! I mean it has some purpose, perhaps in the future when I get things settled down here first!

This section need not be split up as it is quite straightforward!

Here is an example of the On/Off Buttons I was talking about, it is quite neat huh?! The simplest thing about it is that it looks darn good, and can be quite versatile, it allows you to use it as a left frame to right frame switching technique as well. i will explain more later.

This is with border of 3 This is with a border of 10 This one has a lighter shade to it.

The Code:
Here I will explain the basics of the code, you will then have to extrapolate the knowledge in these lines to suit your own needs. The code is in default text colour and the explanations will be coded in brown. Don't you worry, the default code will be given to you later on!

<applet code="button.class" width="120" height="100">
This line calls up the button.class applet and designate what dimensions it should take up. You can alter the width and height dimensions as you see fit.
<param name="buttons" value="3">
This line specifies the number of buttons you wish to have in this case I have chosen 3!
<param name="color" value="800000">
This line choose the colour of the buttons. I like the buttons to take on a brownish colour so the hexadecimal value for this brown is #8000000 you need to drop the # sign in order for the applet to work correctly. Hence you need a colour picker! You can get one at http://www.tucows.com choose a site closes to you and look for "colour pickers" under the html section.
<param name="direction" value="0">
This code specifies how should the buttons align themselves, 0 is for horizontal while 1 is for vertical.
<param name="border width" value="3">
This code allows you to pick the degree of buttonisation. For a thicker border you would expect a more button like look, instead of a platey look.
<param name="degree" value="20">
This controls the degree of opacity of the button borders. A higher number makes the border colours look more pronounced.
<param name="style" value="1">
This line actually specifies if the button becomes an on/off button OR it just changes the highlighted text colour. 1 enables the on/off effect while 0 only allows the buttons to change colour once the mouse glides over it.
<param name="f_size" value="9">
Here the code specifies how big or small the font should be. A larger number means a larger font is used.
<param name="f_style" value="0">
<param name="f_color" value=" ffffff">
Here I chose the unhovered button to take a white colour. You can change the hexadecimal colour to suite your needs.
<param name="f_color2" value="fee1ab">
Now I choose the hovered colour. Again you can change this as you like.
<param name="position" value="0">
This line controls the justification of text on the buttons. 0 is for CENTRE justified, 1 if for LEFT and 2 is for RIGHT.
<param name="f_offset" value="0">
Here, the offset or the spacing of the text from the left or right side of the button can be specified.
<param name="font" value="arial">
This one controls the font that the button uses.
<param name="label 0" value="JAVA Scripting">
<param name="label 1" value="JAVA Applets">
<param name="label 2" value="HTML Writing">
The three paramaters above allows you to control what text goes into the buttons. In this case I chosen, JAVA Scripting, JAVA Applets and HTML Writing.
<param name="link 0" value="tutorial_java.html">
<param name="link 1" value="tutorial_javaapplet.html">
<param name="link 2" value="tutorial.html">
These other 3 parameters tell the browser to load which URL or HTML File when the button is clicked.
<param name="image 0">
<param name="image 1">
<param name="image 2">
I haven't found out what this one does, but once I do, I 'll let you know :P
<param name="frame 0" value="_self">
<param name="frame 1" value="_self">
<param name="frame 2" value="_self">
This one controls which frame or window the clicked file is loaded, hence you can see its versatility, simply because you can tell it to load on main or _top or _blank or whatever frame you wish it to load in.
</applet>

Now to install this baby you need to do the following.

  1. Click here to download button.class, then upload it to your server where you plan to use the on/off buttons. Remember to hold down the shift button while clicking the link.
  2. A save as dialogue would open and what you do is save it to your hard disk.
  3. Code the HTML for the buttons before uploading to the server.

Easy isn't it? Well, here's the standard code I promised, just copy and paste to your HTML file where you need the button to appear!

<applet code="button.class" width="120" height="100">
<param name="buttons" value="3">
<param name="color" value="800000">
<param name="direction" value="0">
<param name="border width" value="3">
<param name="degree" value="20">
<param name="style" value="1">
<param name="f_size" value="9">
<param name="f_style" value="0">
<param name="f_color" value=" ffffff">
<param name="f_color2" value="fee1ab">
<param name="position" value="0">
<param name="f_offset" value="0">
<param name="font" value="arial">
<param name="label 0" value="button_text_1">
<param name="label 1" value="button_text_2">
<param name="label 2" value="button_text_3">
<param name="link 0" value="url_1/HTML file">
<param name="link 1" value="url_2/HTML file">
<param name="link 2" value="url_3/HTML file">
<param name="image 0">
<param name="image 1">
<param name="image 2">
<param name="frame 0" value="_self">
<param name="frame 1" value="_self">
<param name="frame 2" value="_self">
</applet>

Please click here for a printable version of this page.

Notes from Alex:

If you found my tutorial helpful, please drop a note by my guestbook! So I know that you have dropped by and benefitted from my efforts, it took me quite sometime to get these tutorial up! Click on home and then SIGN GUESTBOOK! I will also visit your homepage at GeoCities and sign your guestbook if you sign mine!

[ Emiri Nakayama | Sailor Mars, Rei | About Me | Photo Gallery ]
[ WWW Resources | HTML Tutorials | Hints & Tips | Banner Exchange ]
[ Awards | Win My Award | Home | Links | Change Music | E-Mail Me ]

Back to where you came from!

LinkExchange Network
LinkExchange Member Free Home Pages at GeoCities