By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,541 Members | 1,109 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,541 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.