2 * Sun Public License Notice
4 * The contents of this file are subject to the Sun Public License
5 * Version 1.0 (the "License"). You may not use this file except in
6 * compliance with the License. A copy of the License is available at
9 * The Original Code is NetBeans. The Initial Developer of the Original
10 * Code is Sun Microsystems, Inc. Portions Copyright 1999-2006 Sun
11 * Microsystems, Inc. All Rights Reserved.
16 import implpkg.Accessor;
17 import javax.swing.event.ChangeEvent;
18 import javax.swing.event.ChangeListener;
20 /** Class in API that everyone can use.
22 * @author Jaroslav Tulach
24 public final class Item {
26 private ChangeListener listener;
29 Accessor.DEFAULT = new AccessorImpl();
32 /** Contructor for friends */
36 /** Anyone can value of the item. At least if it can get a reference to it.
38 public void setValue(int x) {
40 ChangeListener l = listener;
42 l.stateChanged(new ChangeEvent(this));
46 /** Anyone can get the value of the item.
48 public int getValue() {
52 /** Only the impl package can listen.
54 void addChangeListener(ChangeListener l) {
55 assert listener == null;