01: /*
02: * Copyright Javelin Software, All rights reserved.
03: */
04:
05: package com.javelin.swinglets.plaf.html;
06:
07: import java.awt.*;
08: import java.awt.event.*;
09: import java.util.*;
10: import java.io.*;
11:
12: import com.javelin.swinglets.*;
13: import com.javelin.swinglets.plaf.*;
14:
15: /**
16: * HTMLComboBoxUI defines a look and feel for default HTML.
17: *
18: * @author Robin Sharp
19: */
20:
21: public class HTMLComboBoxUI extends HTMLComponentUI {
22: /**
23: * Render the UI on the PrintWriter
24: */
25: public void update(PrintWriter out, SComponent c) {
26: if (!c.isVisible())
27: return;
28:
29: SComboBox combo = (SComboBox) c;
30:
31: out.print("<SELECT ");
32:
33: if (c.isEnabled()) {
34: HTMLUtility.setName(out, combo);
35: }
36:
37: if (!c.isEnabled()) {
38: out.print(" DISABLED");
39: }
40:
41: HTMLUtility.setTabIndex(out, c);
42:
43: HTMLUtility.setMouseOverStatusText(out, c.getToolTipText());
44:
45: updateEvent(out, c);
46:
47: out.println(">");
48:
49: for (int index = 0; index < combo.getItemCount(); index++) {
50: out.print("<OPTION VALUE=\"");
51: out.print(index);
52:
53: if (combo.getSelectedIndex() == index) {
54: out.print("\" SELECTED>");
55: } else {
56: out.print("\">");
57: }
58:
59: out.print(combo.getItemAt(index).toString());
60: out.println("</OPTION>");
61: }
62:
63: out.println("</SELECT>");
64:
65: }
66:
67: }
|