468,242 Members | 1,436 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,242 developers. It's quick & easy.

Problem using JComboBox.removeAllItems() in WinXP and JRE 1.5

Hi All,
I developed an application (JFrame) to connect to mysql database. The
application will select price from itemsTable and add each each item
to a JComboBox. If the user change the prices in the database tabl,
he/she should press a button in the application to reload the prices
from the database.
Once the user clicks the buttons, it removes all the items, using
removeAllItems(), from the JComboBox then add the new prices.
It works fine in windows 2k but when I run it in WinXP, the items are
not removed. It appends to the existing items. It also, remove the
drop down arrow ( the arrow that you click to view all the items).

part of the code that does the addition and removals is:
flowerJButtons.reloadItems().addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ae)
{
itemsPrices=flowerGetAllItems.callGetItem();

itemsExist.removeAllItems();
pricesExist.removeAllItems();
items.removeAllItems();
prices.removeAllItems();

prices.addItem("Price");
pricesExist.addItem("Price");
items.addItem("Choose an item");
itemsExist.addItem("Choose an item");
for(int i =0;i<itemsPrices.length;i++)
{
prices.addItem(itemsPrices[1][i]);
items.addItem(itemsPrices[0][i]);
pricesExist.addItem(itemsPrices[1][i]);
itemsExist.addItem(itemsPrices[0][i]);
}

}

}

);
Thank you in advance
Jul 17 '05 #1
0 3062

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Hal Vaughan | last post: by
1 post views Thread by Robert | last post: by
2 posts views Thread by jerico | last post: by
oll3i
3 posts views Thread by oll3i | last post: by
2 posts views Thread by thesti | last post: by
2 posts views Thread by javatech007 | last post: by
4 posts views Thread by pleb | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.