Java tutorial

Revision as of 5 August 2014 15:24 by sannanordgren (Comments | Contribs)

This guide was written to help people with no Java experience get into the more advanced functions offered via the skin interface, for example the ability to write beanshell scripts (interpreted Java). This guide was very kindly written by Laura Seabrook and was previously posted to the forum. It is now presented here as a permanent reference.


glödlampa.png

You can run Java code samples interactively in the "jAlbum console window" available from the help menu.


This guide is broken down into four sections as follows:


Contents

1. Literals, Variables and Expressions

I'm writing this for people who, like me, aren't that familiar with Java as a programming language, but would like to use some of it to customise their jAlbum skins. I'm no expert -- in fact until I downloaded jAlbum I hadn't even looked at ANY Java coding. This is not a full tutorial because I don't know that much, but hopefully it will help you get started. The following has been culled from various books explaining Java, and from other topics in the forums, and repeats information from the help pages as well.

Scriptlets

The first thing to realise is that you can include Beanshell scripts directly on the htt pages. Beanshell is just a "shell" under which Java codes can be written and evaluated directly. To write such code, you need to place it like so...

<%
	CODE GOES HERE;
%>

Literals

Variables

Expressions

2. Decision Structures

Boolean conditions

if

switch and case

while

do while

for

break

3. Methods

Boolean

Numeric

Character

String

4. Interfacing with jAlbum

Original code

Example one - Tables

Example two - Filters