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.util.*;
09: import java.io.*;
10:
11: import com.javelin.swinglets.*;
12: import com.javelin.swinglets.plaf.*;
13:
14: /**
15: * HTMLButtonUI defines a look and feel for default HTML.
16: *
17: * @author Robin Sharp
18: */
19:
20: public class HTMLButtonUI extends HTMLComponentUI {
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: SAbstractButton button = (SAbstractButton) c;
29:
30: out.print("<INPUT TYPE=\"");
31: out.print(button.getIcon() != null ? "IMAGE" : "SUBMIT");
32: out.print("\"");
33:
34: if (button.getBorder() == null) {
35: out.print(" BORDER=0");
36: }
37:
38: if (c.isEnabled()) {
39: HTMLUtility.setName(out, button);
40: }
41:
42: HTMLUtility.setTabIndex(out, c);
43:
44: HTMLUtility.setValue(out, button);
45:
46: if (button.isSelected() && button.getSelectedIcon() != null) {
47: HTMLUtility.setSrc(out, button.getSelectedIcon());
48: } else if (button.getIcon() != null) {
49: HTMLUtility.setSrc(out, button.getIcon());
50: }
51:
52: if (!c.isEnabled()) {
53: out.print(" DISABLED");
54: }
55:
56: HTMLUtility.setMouseOverStatusText(out, c.getToolTipText());
57:
58: updateEvent(out, c);
59:
60: out.println(" >");
61:
62: }
63:
64: }
|