473,512 Members | 15,196 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3228

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4709
by: Hal Vaughan | last post by:
I have a JComboBox with a list of numbers, from 1 digit to 5 digits. Numbers with more than 3 digits have a comma in them. I've been aligning them with leading spaces. Is there any simple and...
1
9885
by: Robert | last post by:
When I select a normal cell with a default editor for strings and press a letter key, the letter is automaticaly typed in the cell, but when I select a cell with an editable JComboBox editor and...
2
9905
by: jerico | last post by:
Hi, I am developing an application for which I need to increase the size of the JComboBox.But it is not getting increased.I used the following technique: Container cont; JComboBox valueTypeBox ;...
3
1737
oll3i
by: oll3i | last post by:
package zad41; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.*; import java.net.*; import javax.swing.BorderFactory;
8
1847
oll3i
by: oll3i | last post by:
package zad41; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.*; import java.net.*; import javax.swing.BorderFactory;
5
4127
by: wajedali | last post by:
Hi I am having trouble rendering a combo box with icon near the text. Below is a simple code which demonstrates my problem. import java.awt.Component; import java.util.HashMap; import...
2
2859
by: thesti | last post by:
hi, How to, if user change the selected item of a JComboBox, it will enable another JComboBox. it's like a validation that the user has to select the year first, then the month, than the date. ...
2
1627
by: javatech007 | last post by:
I am trying to use comboboxes in a ticket payment screen for train tickets. I have two combo boxes. One for picking a route and the other for picking a time. What i want is when you pick a route in...
4
1245
by: pleb | last post by:
Hey Guys, if i want to get the total price in total = new JTextField(20); c.add(total); would i first have to save the price per ticket in a...
0
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7093
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7517
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5676
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1583
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.