473,406 Members | 2,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Help How to bind jComboBox with database?

jeffbroodwar
118 100+
Hi Everyone,

I need to do a program that will display the fields of the database in a combo box. but the problem is, i can't use the manual adding of fields to the combo box like this :

Expand|Select|Wrap|Line Numbers
  1.             ResultSet rs = stmt.executeQuery("Select * FROM SampleTable");
  2.             rs.first();
  3.             for(int i = 0; i <= 4; i ++)
  4.             {
  5.                 jComboBox1.addItem(rs.getString("Name"));
  6.                 rs.next();
  7.             }
  8.  
what is need is to bind the combobox to the database... Thanks in advance...

Regards,
Jeff
Jul 2 '07 #1
3 6838
jeffbroodwar
118 100+
HI,

What property of jComboBox will allow me to set the tables to be bound with it? please see this link.... http://docs.sun.com/source/816-4685/jdbc.html . I can't figure out what model property is this tutorial's saying.... please help me.... thanks

Regards,
Jeff
Jul 2 '07 #2
jeffbroodwar
118 100+
hmmm...... it seems no one's answering me.... ok just one question... is it possible to bind swing objects with database like in vb6 we can bind text boxes to the fields of a specific database table (using data control)????
Jul 3 '07 #3
jeffbroodwar
118 100+
Issue solved....

create a java bean that will expose all the needed parameters for the database connection.


for the easier approach (netbeans users)... wait for the release of netbeans 6.0. Said to be launched in the last quarter of 2007. New features were added including Data binding of database to swing components.

Regards,
Jeff
Jul 3 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
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...
0
by: Yasser | last post by:
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...
1
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...
1
nomad
by: nomad | last post by:
I need help with JcomboBox When and User select the Exit in the File box it will the //inner class class exitListener implements ActionListener { ... } which it open a window asking them if...
0
jeffbroodwar
by: jeffbroodwar | last post by:
Hi Everyone, I'm using netbeans 5.5. I've read in an article that netbeans will allow data binding in their 6.0 release. Now, i know that the other way to achieve this is by binding the swing...
2
by: carlos123 | last post by:
Ok i have a few different arrays for names, last names, address, and city , and i have a textfield for each one. Ultimatly i want my project to be able to enter the names in and hit "save" and it...
3
by: carlos123 | last post by:
Ok, im having EXTREME problems, with arraylists, i simply dont understand them, yes i have read your article. Would someone just take a look at this code, i know it sucks. Look at the areas that say...
2
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...
1
by: onlinegear | last post by:
HI i am writing this for college i know i have loads of combo boxes with nothing in the i havent got that far yet. but every time i run this is comes up with this erro run: Exception in thread...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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
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,...

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.