1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.onemind.awtbridge.peer;
22
23 import java.awt.Dimension;
24 import java.awt.FontMetrics;
25 import java.awt.peer.ChoicePeer;
26 import org.onemind.awtbridge.BridgeContext;
27 /***
28 * A choice peer
29 * @author TiongHiang Lee (thlee@onemindsoft.org)
30 * @version $Id: BridgeChoicePeer.java,v 1.3 2005/03/12 23:03:11 thlee Exp $ $Name: awtbridge-1_0_0 $
31 */
32 public class BridgeChoicePeer extends BridgeComponentPeer implements ChoicePeer
33 {
34
35 /***
36 * {@inheritDoc}
37 */
38 public BridgeChoicePeer(Object componentObject, BridgeContext context)
39 {
40 super(componentObject, context);
41 }
42
43 /***
44 * {@inheritDoc}
45 */
46 public final void add(String item, int index)
47 {
48 setUpToDate(false);
49 }
50
51 /***
52 * {@inheritDoc}
53 */
54 public final void addItem(String item, int index)
55 {
56 setUpToDate(false);
57 }
58
59 /***
60 * {@inheritDoc}
61 */
62 public final void remove(int index)
63 {
64 setUpToDate(false);
65 }
66
67 /***
68 * {@inheritDoc}
69 */
70 public final void removeAll()
71 {
72 setUpToDate(false);
73 }
74
75 /***
76 * {@inheritDoc}
77 */
78 public final void select(int index)
79 {
80 setUpToDate(false);
81 }
82
83 /***
84 * TODO: To be implemented
85 * {@inheritDoc}
86 */
87 public Dimension preferredSize()
88 {
89 FontMetrics m = getCurrentFontMetrics();
90 return new Dimension(m.charWidth('A') * 20, m.getHeight());
91 }
92 }