Source Code Cross Referenced for ButtonModel.java in  » 6.0-JDK-Core » swing » javax » swing » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » swing » javax.swing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 1997-2006 Sun Microsystems, Inc.  All Rights Reserved.
003         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004         *
005         * This code is free software; you can redistribute it and/or modify it
006         * under the terms of the GNU General Public License version 2 only, as
007         * published by the Free Software Foundation.  Sun designates this
008         * particular file as subject to the "Classpath" exception as provided
009         * by Sun in the LICENSE file that accompanied this code.
010         *
011         * This code is distributed in the hope that it will be useful, but WITHOUT
012         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014         * version 2 for more details (a copy is included in the LICENSE file that
015         * accompanied this code).
016         *
017         * You should have received a copy of the GNU General Public License version
018         * 2 along with this work; if not, write to the Free Software Foundation,
019         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020         *
021         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022         * CA 95054 USA or visit www.sun.com if you need additional information or
023         * have any questions.
024         */
025        package javax.swing;
026
027        import java.awt.event.*;
028        import java.awt.*;
029        import javax.swing.event.*;
030
031        /**
032         * State model for buttons.
033         * <p>
034         * This model is used for regular buttons, as well as check boxes
035         * and radio buttons, which are special kinds of buttons. In practice,
036         * a button's UI takes the responsibility of calling methods on its
037         * model to manage the state, as detailed below:
038         * <p>
039         * In simple terms, pressing and releasing the mouse over a regular
040         * button triggers the button and causes and <code>ActionEvent</code>
041         * to be fired. The same behavior can be produced via a keyboard key
042         * defined by the look and feel of the button (typically the SPACE BAR).
043         * Pressing and releasing this key while the button has
044         * focus will give the same results. For check boxes and radio buttons, the
045         * mouse or keyboard equivalent sequence just described causes the button
046         * to become selected.
047         * <p>
048         * In details, the state model for buttons works as follows
049         * when used with the mouse:
050         * <br>
051         * Pressing the mouse on top of a button makes the model both
052         * armed and pressed. As long as the mouse remains down,
053         * the model remains pressed, even if the mouse moves
054         * outside the button. On the contrary, the model is only
055         * armed while the mouse remains pressed within the bounds of
056         * the button (it can move in or out of the button, but the model
057         * is only armed during the portion of time spent within the button).
058         * A button is triggered, and an <code>ActionEvent</code> is fired,
059         * when the mouse is released while the model is armed
060         * - meaning when it is released over top of the button after the mouse
061         * has previously been pressed on that button (and not already released).
062         * Upon mouse release, the model becomes unarmed and unpressed.
063         * <p>
064         * In details, the state model for buttons works as follows
065         * when used with the keyboard:
066         * <br>
067         * Pressing the look and feel defined keyboard key while the button
068         * has focus makes the model both armed and pressed. As long as this key
069         * remains down, the model remains in this state. Releasing the key sets
070         * the model to unarmed and unpressed, triggers the button, and causes an
071         * <code>ActionEvent</code> to be fired.
072         *
073         * @version 1.35 05/05/07
074         * @author Jeff Dinkins
075         */
076        public interface ButtonModel extends ItemSelectable {
077
078            /**
079             * Indicates partial commitment towards triggering the
080             * button.
081             *
082             * @return <code>true</code> if the button is armed,
083             *         and ready to be triggered
084             * @see #setArmed
085             */
086            boolean isArmed();
087
088            /**
089             * Indicates if the button has been selected. Only needed for
090             * certain types of buttons - such as radio buttons and check boxes.
091             *
092             * @return <code>true</code> if the button is selected
093             */
094            boolean isSelected();
095
096            /**
097             * Indicates if the button can be selected or triggered by
098             * an input device, such as a mouse pointer.
099             *
100             * @return <code>true</code> if the button is enabled
101             */
102            boolean isEnabled();
103
104            /**
105             * Indicates if the button is pressed.
106             *
107             * @return <code>true</code> if the button is pressed
108             */
109            boolean isPressed();
110
111            /**
112             * Indicates that the mouse is over the button.
113             *
114             * @return <code>true</code> if the mouse is over the button
115             */
116            boolean isRollover();
117
118            /**
119             * Marks the button as armed or unarmed.
120             * 
121             * @param b whether or not the button should be armed
122             */
123            public void setArmed(boolean b);
124
125            /**
126             * Selects or deselects the button.
127             *
128             * @param b <code>true</code> selects the button,
129             *          <code>false</code> deselects the button
130             */
131            public void setSelected(boolean b);
132
133            /**
134             * Enables or disables the button.
135             * 
136             * @param b whether or not the button should be enabled
137             * @see #isEnabled
138             */
139            public void setEnabled(boolean b);
140
141            /**
142             * Sets the button to pressed or unpressed.
143             * 
144             * @param b whether or not the button should be pressed
145             * @see #isPressed
146             */
147            public void setPressed(boolean b);
148
149            /**
150             * Sets or clears the button's rollover state
151             * 
152             * @param b whether or not the button is in the rollover state
153             * @see #isRollover
154             */
155            public void setRollover(boolean b);
156
157            /**
158             * Sets the keyboard mnemonic (shortcut key or
159             * accelerator key) for the button.
160             *
161             * @param key an int specifying the accelerator key
162             */
163            public void setMnemonic(int key);
164
165            /**
166             * Gets the keyboard mnemonic for the button.
167             *
168             * @return an int specifying the accelerator key
169             * @see #setMnemonic
170             */
171            public int getMnemonic();
172
173            /**
174             * Sets the action command string that gets sent as part of the
175             * <code>ActionEvent</code> when the button is triggered.
176             *
177             * @param s the <code>String</code> that identifies the generated event
178             * @see #getActionCommand
179             * @see java.awt.event.ActionEvent#getActionCommand
180             */
181            public void setActionCommand(String s);
182
183            /**
184             * Returns the action command string for the button.
185             *
186             * @return the <code>String</code> that identifies the generated event
187             * @see #setActionCommand
188             */
189            public String getActionCommand();
190
191            /**
192             * Identifies the group the button belongs to --
193             * needed for radio buttons, which are mutually
194             * exclusive within their group.
195             *
196             * @param group the <code>ButtonGroup</code> the button belongs to
197             */
198            public void setGroup(ButtonGroup group);
199
200            /**
201             * Adds an <code>ActionListener</code> to the model.
202             *
203             * @param l the listener to add
204             */
205            void addActionListener(ActionListener l);
206
207            /**
208             * Removes an <code>ActionListener</code> from the model.
209             *
210             * @param l the listener to remove
211             */
212            void removeActionListener(ActionListener l);
213
214            /**
215             * Adds an <code>ItemListener</code> to the model.
216             *
217             * @param l the listener to add
218             */
219            void addItemListener(ItemListener l);
220
221            /**
222             * Removes an <code>ItemListener</code> from the model.
223             *
224             * @param l the listener to remove
225             */
226            void removeItemListener(ItemListener l);
227
228            /**
229             * Adds a <code>ChangeListener</code> to the model.
230             *
231             * @param l the listener to add
232             */
233            void addChangeListener(ChangeListener l);
234
235            /**
236             * Removes a <code>ChangeListener</code> from the model.
237             *
238             * @param l the listener to remove
239             */
240            void removeChangeListener(ChangeListener l);
241
242        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.