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
This commit is contained in:
parent
6310608457
commit
d416de057b
2 changed files with 20 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue