01: /*
02: * Copyright Javelin Software, All rights reserved.
03: */
04:
05: package com.javelin.examples.swinglets;
06:
07: import java.util.*;
08: import java.io.*;
09: import java.awt.*;
10: import java.awt.event.*;
11:
12: import javax.servlet.*;
13: import javax.servlet.http.*;
14:
15: import com.javelin.swinglets.*;
16:
17: /**
18: * Panel to display some balls.
19: *
20: * @author Robin Sharp
21: */
22:
23: public class BallsPanel extends SPanel {
24: public BallsPanel(boolean vertical) {
25: setBackground(SColor.getColor("salmon1")); //ug
26:
27: if (vertical) {
28: setLayoutManager(new SFlowLayout(SConstants.LEFT));
29: } else {
30: setLayoutManager(new SFlowLayout(SConstants.RIGHT));
31: }
32:
33: //LOOP AROUND CREATING BALLS
34: for (int index = 10; index < 80; index += 10) {
35: SIcon icon = new SIcon("blue-ball.gif", index, index);
36:
37: //CREATE AN ICON WITH SOME TEXT
38: SLabel label = new SLabel(icon, "TEXT " + index);
39:
40: //SET A LINK ON THE LABEL
41: //label.setLink( new SLink( "images/red-ball.gif" ) );
42:
43: //SET THE FONT (SIZE) ON THE LABEL
44: label.setFont(SFont
45: .getFont("SansSerif", SFont.PLAIN, index));
46:
47: //ADD THE LABEL
48: add(label);
49: }
50:
51: }
52: }
|