1 |
/* JComboBox.java -- |
/* JComboBox.java -- |
2 |
Copyright (C) 2002, 2004 Free Software Foundation, Inc. |
Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
92 |
* Maximum number of rows that should be visible by default in the |
* Maximum number of rows that should be visible by default in the |
93 |
* JComboBox's popup |
* JComboBox's popup |
94 |
*/ |
*/ |
95 |
public static final int DEFAULT_MAXIMUM_ROW_COUNT = 8; |
private static final int DEFAULT_MAXIMUM_ROW_COUNT = 8; |
|
|
|
|
/** |
|
|
* Fired in a PropertyChangeEvent when the 'editable' property changes. |
|
|
*/ |
|
|
public static final String EDITABLE_CHANGED_PROPERTY = "editable"; |
|
|
|
|
|
/** |
|
|
* Fired in a PropertyChangeEvent when the 'maximumRowCount' property |
|
|
* changes. |
|
|
*/ |
|
|
public static final String MAXIMUM_ROW_COUNT_CHANGED_PROPERTY = "maximumRowCount"; |
|
|
|
|
|
/** |
|
|
* Fired in a PropertyChangeEvent when the 'enabled' property changes. |
|
|
*/ |
|
|
public static final String ENABLED_CHANGED_PROPERTY = "enabled"; |
|
|
|
|
|
/** |
|
|
* Fired in a PropertyChangeEvent when the 'renderer' property changes. |
|
|
*/ |
|
|
public static final String RENDERER_CHANGED_PROPERTY = "renderer"; |
|
|
|
|
|
/** |
|
|
* Fired in a PropertyChangeEvent when the 'editor' property changes. |
|
|
*/ |
|
|
public static final String EDITOR_CHANGED_PROPERTY = "editor"; |
|
|
|
|
|
/** |
|
|
* Fired in a PropertyChangeEvent when the 'dataModel' property changes. |
|
|
*/ |
|
|
public static final String MODEL_CHANGED_PROPERTY = "dataModel"; |
|
|
|
|
|
/** |
|
|
* name for the UI delegate for this combo box. |
|
|
*/ |
|
|
private static final String uiClassID = "ComboBoxUI"; |
|
96 |
|
|
97 |
/** |
/** |
98 |
* dataModel used by JComboBox to keep track of its list data and currently |
* dataModel used by JComboBox to keep track of its list data and currently |
262 |
*/ |
*/ |
263 |
public String getUIClassID() |
public String getUIClassID() |
264 |
{ |
{ |
265 |
return uiClassID; |
return "ComboBoxUI"; |
266 |
} |
} |
267 |
|
|
268 |
/** |
/** |
306 |
dataModel = newDataModel; |
dataModel = newDataModel; |
307 |
|
|
308 |
// Notifies the listeners of the model change. |
// Notifies the listeners of the model change. |
309 |
firePropertyChange(MODEL_CHANGED_PROPERTY, oldDataModel, dataModel); |
firePropertyChange("model", oldDataModel, dataModel); |
310 |
} |
} |
311 |
|
|
312 |
/** |
/** |
361 |
if (isEditable != editable) |
if (isEditable != editable) |
362 |
{ |
{ |
363 |
isEditable = editable; |
isEditable = editable; |
364 |
firePropertyChange(EDITABLE_CHANGED_PROPERTY, ! isEditable, isEditable); |
firePropertyChange("editable", ! isEditable, isEditable); |
365 |
} |
} |
366 |
} |
} |
367 |
|
|
379 |
{ |
{ |
380 |
int oldMaximumRowCount = maximumRowCount; |
int oldMaximumRowCount = maximumRowCount; |
381 |
maximumRowCount = rowCount; |
maximumRowCount = rowCount; |
382 |
firePropertyChange(MAXIMUM_ROW_COUNT_CHANGED_PROPERTY, |
firePropertyChange("maximumRowCount", |
383 |
oldMaximumRowCount, maximumRowCount); |
oldMaximumRowCount, maximumRowCount); |
384 |
} |
} |
385 |
} |
} |
411 |
{ |
{ |
412 |
ListCellRenderer oldRenderer = renderer; |
ListCellRenderer oldRenderer = renderer; |
413 |
renderer = aRenderer; |
renderer = aRenderer; |
414 |
firePropertyChange(RENDERER_CHANGED_PROPERTY, oldRenderer, |
firePropertyChange("renderer", oldRenderer, |
415 |
renderer); |
renderer); |
416 |
} |
} |
417 |
} |
} |
447 |
if (editor != null) |
if (editor != null) |
448 |
editor.addActionListener(this); |
editor.addActionListener(this); |
449 |
|
|
450 |
firePropertyChange(EDITOR_CHANGED_PROPERTY, oldEditor, editor); |
firePropertyChange("editor", oldEditor, editor); |
451 |
} |
} |
452 |
|
|
453 |
/** |
/** |
931 |
if (enabled != oldEnabled) |
if (enabled != oldEnabled) |
932 |
{ |
{ |
933 |
super.setEnabled(enabled); |
super.setEnabled(enabled); |
934 |
firePropertyChange(ENABLED_CHANGED_PROPERTY, oldEnabled, |
firePropertyChange("enabled", oldEnabled, enabled); |
|
(boolean) enabled); |
|
935 |
} |
} |
936 |
} |
} |
937 |
|
|