01: /*
02: * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05:
06: package com.sun.portal.instance.common.listener;
07:
08: //
09:
10: import com.sun.portal.config.context.DebugContext;
11:
12: import java.awt.*;
13: import java.awt.event.ItemEvent;
14: import java.awt.event.ItemListener;
15:
16: //
17:
18: public class ChoiceListener implements ItemListener {
19: //
20: protected String choice = null;
21:
22: public ChoiceListener(String initialChoice) {
23: choice = initialChoice;
24: }
25:
26: //
27: //
28: //
29: public void itemStateChanged(ItemEvent e) {
30: int stateChange = e.getStateChange();
31: switch (stateChange) {
32: case ItemEvent.SELECTED:
33: choice = ((Choice) e.getItemSelectable()).getSelectedItem();
34: DebugContext.message("Selected choice <" + choice + ">");
35: }
36: }
37:
38: public String getSelectedItem() {
39: return choice;
40: }
41: }
|