Commit d416de05 by Fernando Nasser Committed by Fernando Nasser

List.java (replaceItem): Prevent selection to move with replace and minimize flickering.

2003-12-18  Fernando Nasser  <fnasser@redhat.com>

        * java/awt/List.java (replaceItem): Prevent selection to move with
        replace and minimize flickering.

From-SVN: r74814
parent 63106084
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> 2003-12-18 Michael Koch <konqueror@gmx.de>
* libltdl/ltdl.c: Define __private_extern__ if needed. * libltdl/ltdl.c: Define __private_extern__ if needed.
......
...@@ -647,8 +647,21 @@ clear() ...@@ -647,8 +647,21 @@ clear()
public synchronized void public synchronized void
replaceItem(String item, int index) throws IllegalArgumentException replaceItem(String item, int index) throws IllegalArgumentException
{ {
remove(index); if ((index < 0) || (index >= items.size()))
addItem(item, index); 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);
}
} }
/*************************************************************************/ /*************************************************************************/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment