diff options
author | fnasser <fnasser@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-12-19 02:53:36 +0000 |
---|---|---|
committer | fnasser <fnasser@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-12-19 02:53:36 +0000 |
commit | a4d123459fb66cd505cd1d8c7977bee206a5130d (patch) | |
tree | b464e8e7a76f9704ee26827f12448545c4fdd3f2 /libjava | |
parent | e4dcc9da5332ebb36287986a5d859eb143c3da47 (diff) | |
download | gcc-a4d123459fb66cd505cd1d8c7977bee206a5130d.tar.gz |
2003-12-18 Fernando Nasser <fnasser@redhat.com>
* java/awt/List.java (replaceItem): Prevent selection to move with
replace and minimize flickering.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74814 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 5 | ||||
-rw-r--r-- | libjava/java/awt/List.java | 17 |
2 files changed, 20 insertions, 2 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index ecb767c01c6..231cf35a752 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2003-12-18 Fernando Nasser <fnasser@redhat.com> + + * java/awt/List.java (replaceItem): Prevent selection to move with + replace and minimize flickering. + 2003-12-18 Michael Koch <konqueror@gmx.de> * libltdl/ltdl.c: Define __private_extern__ if needed. diff --git a/libjava/java/awt/List.java b/libjava/java/awt/List.java index 23ca34fab0c..79b2faa6299 100644 --- a/libjava/java/awt/List.java +++ b/libjava/java/awt/List.java @@ -647,8 +647,21 @@ clear() public synchronized void replaceItem(String item, int index) throws IllegalArgumentException { - remove(index); - addItem(item, index); + if ((index < 0) || (index >= items.size())) + throw new IllegalArgumentException("Bad list index: " + index); + + items.insertElementAt(item, index + 1); + items.removeElementAt (index); + + if (peer != null) + { + ListPeer l = (ListPeer) peer; + + /* We add first and then remove so that the selected + item remains the same */ + l.add (item, index + 1); + l.delItems (index, index); + } } /*************************************************************************/ |