summaryrefslogtreecommitdiff
path: root/java/awt/Choice.java
diff options
context:
space:
mode:
authorLillian Angel <langel@redhat.com>2006-02-08 16:31:23 +0000
committerLillian Angel <langel@redhat.com>2006-02-08 16:31:23 +0000
commitfccb493744abc35bda29f5e72cac6d3d552765fa (patch)
tree7b7cbb38410903dcad72b0b8bd10cbe32da9f5b0 /java/awt/Choice.java
parent41bf1effc9065d1a29ffc23b90ce4555cd20d2bd (diff)
downloadclasspath-fccb493744abc35bda29f5e72cac6d3d552765fa.tar.gz
2006-02-08 Lillian Angel <langel@redhat.com>
* java/awt/Choice.java (select): Fixed up code, added some checks to prevent errors. (dispatchEventImpl): Removed. This function is not needed. It causes several assertion errors.
Diffstat (limited to 'java/awt/Choice.java')
-rw-r--r--java/awt/Choice.java25
1 files changed, 7 insertions, 18 deletions
diff --git a/java/awt/Choice.java b/java/awt/Choice.java
index df93c5b07..2e55d19b2 100644
--- a/java/awt/Choice.java
+++ b/java/awt/Choice.java
@@ -468,15 +468,16 @@ getSelectedIndex()
public synchronized void
select(int index)
{
- if ((index < 0) || (index > getItemCount()))
+ if ((index < 0) || (index >= getItemCount()))
throw new IllegalArgumentException("Bad index: " + index);
- this.selectedIndex = index;
- if (peer != null)
- {
+ if (pItems.size() > 0) {
+ selectedIndex = index;
ChoicePeer cp = (ChoicePeer) peer;
- cp.select (index);
- }
+ if (cp != null) {
+ cp.select(index);
+ }
+ }
}
/*************************************************************************/
@@ -573,18 +574,6 @@ processItemEvent(ItemEvent event)
item_listeners.itemStateChanged(event);
}
-void
-dispatchEventImpl(AWTEvent e)
-{
- if (e.id <= ItemEvent.ITEM_LAST
- && e.id >= ItemEvent.ITEM_FIRST
- && (item_listeners != null
- || (eventMask & AWTEvent.ITEM_EVENT_MASK) != 0))
- processEvent(e);
- else
- super.dispatchEventImpl(e);
-}
-
/*************************************************************************/
/**