aboutsummaryrefslogtreecommitdiff
path: root/libjava/javax/swing/DefaultListSelectionModel.java
diff options
context:
space:
mode:
authorMichael Koch <konqueror@gmx.de>2004-01-23 12:42:10 +0000
committerMichael Koch <mkoch@gcc.gnu.org>2004-01-23 12:42:10 +0000
commit3ac55a5a69f6a4f2f1acac66a36676c63c428db8 (patch)
treed45ab18ff6f571ac20c614d6c7c6c53cebbdc077 /libjava/javax/swing/DefaultListSelectionModel.java
parent5d7b2198ba194fba04e4b82dc1d223f07bc83da6 (diff)
downloadgcc-3ac55a5a69f6a4f2f1acac66a36676c63c428db8.zip
gcc-3ac55a5a69f6a4f2f1acac66a36676c63c428db8.tar.gz
gcc-3ac55a5a69f6a4f2f1acac66a36676c63c428db8.tar.bz2
AbstractAction.java: Reformated.
2004-01-23 Michael Koch <konqueror@gmx.de> * javax/swing/AbstractAction.java: Reformated. (getPropertyChangeListeners): New method. * javax/swing/AbstractCellEditor.java: Reformated. (getCellEditorListeners): New method. * javax/swing/DefaultListSelectionModel.java (listenerList): New field. (listeners): Removed. (get_listeners): Removed. (addListSelectionListener): Rewritten. (removeListSelectionListener): Rewritten. (getListSelectionListeners): New method. (getListeners): New method. * javax/swing/JComboBox.java: Imports reworked. (addActionListener): Implemented. (removeActionListener): Implemented. (addItemListener): Implemented. (removeItemListener): Implemented. (addPopupMenuListener): Implemented. (removePopupMenuListener): Implemented. (getActionListeners): New method. (getItemListeners): New method. (getPopupMenuListeners): New method. From-SVN: r76413
Diffstat (limited to 'libjava/javax/swing/DefaultListSelectionModel.java')
-rw-r--r--libjava/javax/swing/DefaultListSelectionModel.java40
1 files changed, 23 insertions, 17 deletions
diff --git a/libjava/javax/swing/DefaultListSelectionModel.java b/libjava/javax/swing/DefaultListSelectionModel.java
index 2da790d..7ad66b0 100644
--- a/libjava/javax/swing/DefaultListSelectionModel.java
+++ b/libjava/javax/swing/DefaultListSelectionModel.java
@@ -42,34 +42,20 @@ import java.io.Serializable;
import java.util.EventListener;
import java.util.Vector;
import javax.swing.event.EventListenerList;
+import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
public class DefaultListSelectionModel implements Cloneable, ListSelectionModel, Serializable
{
+ private EventListenerList listenerList = new EventListenerList();
+
int mode = SINGLE_SELECTION;
Vector sel = new Vector();
- Vector listeners;
-
- Vector get_listeners()
- {
- if (listeners == null)
- listeners = new Vector();
- return listeners;
- }
-
-
- public void addListSelectionListener(ListSelectionListener listener)
{
- get_listeners().addElement(listener);
}
- public void removeListSelectionListener(ListSelectionListener listener)
- {
- get_listeners().removeElement(listener);
- }
-
class Range
{
int i0, i1;
@@ -182,4 +168,24 @@ public class DefaultListSelectionModel implements Cloneable, ListSelectionModel,
sel.addElement(new Range(index0, index1));
}
+
+ public void addListSelectionListener(ListSelectionListener listener)
+ {
+ listenerList.add (ListSelectionListener.class, listener);
+ }
+
+ public void removeListSelectionListener(ListSelectionListener listener)
+ {
+ listenerList.remove (ListSelectionListener.class, listener);
+ }
+
+ public ListSelectionListener[] getListSelectionListeners()
+ {
+ return (ListSelectionListener[]) getListeners (ListSelectionListener.class);
+ }
+
+ public EventListener[] getListeners (Class listenerType)
+ {
+ return listenerList.getListeners (listenerType);
+ }
}