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 Jaroslav Tulach. Portions Copyright 2007 Jaroslav Tulach.
11 * 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 // BEGIN: design.less.friend.Item
25 public final class Item {
27 private ChangeListener listener;
29 // BEGIN: design.less.friend.Item.static
31 Accessor.setDefault(new AccessorImpl());
33 // END: design.less.friend.Item.static
35 /** Contructor for friends */
39 /** Anyone can value of the item. At least if it can get a reference to it.
41 public void setValue(int x) {
43 ChangeListener l = listener;
45 l.stateChanged(new ChangeEvent(this));
49 /** Anyone can get the value of the item.
51 public int getValue() {
55 /** Only the impl package can listen.
57 void addChangeListener(ChangeListener l) {
58 assert listener == null;
63 // END: design.less.friend.Item