01: /*
02: * Copyright Javelin Software, All rights reserved.
03: */
04:
05: package com.javelin.swinglets.plaf.wml;
06:
07: import java.awt.*;
08: import java.util.*;
09: import java.io.*;
10:
11: import com.javelin.swinglets.*;
12: import com.javelin.swinglets.plaf.*;
13:
14: /**
15: * WMLButtonGroupUI defines a look and feel for default WML.
16: *
17: * @author Robin Sharp
18: */
19:
20: public class WMLButtonGroupUI extends WMLContainerUI {
21: /**
22: * Render the UI on the PrintWriter
23: */
24: public void update(PrintWriter out, SComponent c) {
25: if (!c.isVisible())
26: return;
27:
28: SButtonGroup group = (SButtonGroup) c;
29:
30: out.print("<select name=\"");
31: out.print(group.getName());
32: out.println("\"");
33:
34: int selectedIndex = group.getSelectedIndex();
35: if (selectedIndex >= 0) {
36: out.print(" ivalue=\"");
37: out.print(selectedIndex + 1);
38: out.print("\"");
39: }
40:
41: out.println(">");
42:
43: for (Enumeration buttons = group.getAllComponents(); buttons
44: .hasMoreElements();) {
45: ((SRadioButton) buttons.nextElement()).paint(out);
46: }
47:
48: out.println("</select>");
49:
50: }
51: }
|