Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Swing-AWT multiple JComboBoxes using with JDBC
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


ranipoornima
multiple JComboBoxes using with JDBC
1 Answer(s)      4 years and a month ago
Posted in : Swing AWT


how to use JComboBoxes with JDBC in java

Advertisement
View Answers

October 16, 2010 at 12:03 PM


Hi Friend,

Try the following code:

import java.awt.*;
import java.sql.*;
import javax.swing.*;
public class MultipleJCombo{

public MultipleJCombo(){
JFrame f = new JFrame("Frame in Java Swing");
JLabel label1=new JLabel("Qualification");
JLabel label2=new JLabel("Specialization");
JComboBox jc1=new JComboBox();
JComboBox jc2=new JComboBox();
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con =DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root";);
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("select * from user_details");
jc1.addItem("Select");
jc2.addItem("Select");
while(rs.next()){
jc1.addItem(rs.getString("qualification"));
jc2.addItem(rs.getString("specialization"));
}
}
catch(Exception e){
}
JPanel p=new JPanel(new GridLayout(2,2));
p.add(label1);
p.add(jc1);
p.add(label2);
p.add(jc2);
f.add(p);
f.setVisible(true);
f.pack();

}
public static void main(String[] args) throws Exception{
MultipleJCombo sf=new MultipleJCombo();
}
}

Thanks


Related Tutorials/Questions & Answers:
multiple JComboBoxes using with JDBC
multiple JComboBoxes using with JDBC  how to use JComboBoxes with JDBC in java  Hi Friend,Try the following code:import java.awt.*;import... =DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root"
Using criteria for multiple tables
Using criteria for multiple tables  How to join more than three tables,those tables must be maintain primary key relation ship using Hql criteria & projections
Advertisements
Using criteria for multiple tables
Using criteria for multiple tables  How to join more than three tables,those tables must be maintain primary key relation ship using Hql criteria & projections
delete multiple row using checkbox
delete multiple row using checkbox  how to delete multiple row in a table which is connected to database using checkbox
delete multiple row using checkbox
delete multiple row using checkbox  how to delete multiple row in a table which is connected to database using checkbox
Email to multiple recipients using jsp
Email to multiple recipients using jsp  Hi sir, Am a doing a project,in that i need to send email to multiple user at a time,the to address should enter manually its not not be written in code using jsp. Regards, Santhosh
Email to multiple recipients using jsp
Email to multiple recipients using jsp  Hi sir, Am a doing a project,in that i need to send email to multiple user at a time,the to address should enter manually its not not be written in code using jsp. Regards, Santhosh
delete multiple row using checkbox
delete multiple row using checkbox  delete multiple row using...("com.mysql.jdbc.Driver").newInstance(); conn = DriverManager.getConnection("jdbc...("com.mysql.jdbc.Driver").newInstance(); conn = DriverManager.getConnection("jdbc:mysql
using Blob in jdbc - JDBC
using Blob in jdbc  Hi, I got an Exception when i was trying to insert one image into oracle 10g database the exception is Exception in thread..."); Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost
Multiple buttons in struts using java script
Multiple buttons in struts using java script  Multiple buttons in struts using java script
Uploading Multiple Files Using Jsp
Uploading Multiple Files Using Jsp  ... to understand how you can upload multiple files by using the Jsp. We should avoid... a file. In this example we are going to tell you how we can upload multiple files
Display Multiple Images in jscrollpane using Java Jpanel
Display Multiple Images in jscrollpane using Java Jpanel  Browse and Display multiple images in vertical view of java jscrollpane using jpanel
JDBC using Spring framework - JDBC
JDBC using Spring framework  Hi, I am using Spring framework in my project. I am making a call to the DB2 procedure using datasource and it returns... the code i'm using... HashMap params = new HashMap(); params.put("Username
Storing Multiple image in sql using java
Storing Multiple image in sql using java  Hi, How to store and retrieve a multiple image in sql using java but already i have created sql table if i want to insert a image while runtime execution. Can anyone tell me solution
how to scroll multiple images using on Click in Android
how to scroll multiple images using on Click in Android  I am new... there is requirement like multiple image scrolling dynamically. But unfortunately i am unable to scroll multiple images. But i am able to scroll single image. plz let me know
Multiple inheritance using interface - Java Beginners
Multiple inheritance using interface  Hi, I understand.... But the use of the interface is when we use multiple inheritance with more than one... in multiple inheritance Thank you, Rajkanth  Hi Friend, Please
inserting multiple file formats into database using html
inserting multiple file formats into database using html   hi the code was working fine,i want to choose the file and then upload to database,by using html.whether it is possible to upload larger file size,please explain
Round of to a multiple of 5 without using function
Round of to a multiple of 5 without using function  Please help me out... U enter values like 239, 2543.876, 962.... Give me an equation without using any function which will give output of 240, 2545, 960 respectively
Round of to a multiple of 5 without using function
Round of to a multiple of 5 without using function  Please help me out... U enter values like 239, 2543.876, 962.... Give me an equation without using any function which will give output of 240, 2545, 960 respectively
database entry using jdbc
database entry using jdbc  Give me a program to enter records in table using jdbc in java.   Hi Friend, Please visit the following link: Insert data into database Thanks
Merge multiple jasper file to one word Doc using java
Merge multiple jasper file to one word Doc using java   how to Merge multiple jasper file to one word Doc using java
how can i achieve multiple inheritance in java without using inheritance ?
how can i achieve multiple inheritance in java without using inheritance ?  how can i achieve multiple inheritance in java without using inheritance
JDBC Transaction Example
successfully. When  you create a connection using JDBC, by default...; } JDBC Transaction Example JDBC Transaction  JDBC transaction... connectionUrl = "jdbc:mysql://localhost:3306/"; String databaseName
using pb datawindow activex with jdbc for mysql - JDBC
using pb datawindow activex with jdbc for mysql  Hi, I am trying to use datawindow activex in a web page. I need to connect to mysql database located on the server. I have downloaded the connectj for mysql. What should
not able to connect to mysql using.. jdbc
not able to connect to mysql using.. jdbc   i am not able to connect to mysql using jdbc .. is there any classpath that i need to set..because i am using mysql-connector-java jar file..to connect to mysql.. Pls provide the steps
excel file using JDBC java.?
excel file using JDBC java.?  hey, i am a telecomm. engineer , and i am try to develop a tool which reads from a excel file and then appends the same... used JDBC ODBC to read from excel file. i am not able to append it using
How to create Multiple Frames using Java Swing
Multiple Frames in Java Swing In this section, you will learn how to create multiple frames. Java Swing provides the utility to show frame within another... JFrame("Multiple Frames"); frame.setDefaultCloseOperation(JFrame.EXIT
How to upload multiple images in java(struts) using jsp?
How to upload multiple images in java(struts) using jsp?  I have jsp...="file" name="file[]" multiple/> <html:submit value = "S U B M I T"/>... to upload the multiple images in struts Total images storing folder in project
How to upload multiple images in java(struts) using jsp?
How to upload multiple images in java(struts) using jsp?  I have jsp...="file" name="file[]" multiple/> <html:submit value = "S U B M I T"/>... to upload the multiple images in struts Total images storing folder in project
How to upload multiple images in java(struts) using jsp?
How to upload multiple images in java(struts) using jsp?  I have jsp...="file" name="file[]" multiple/> <html:submit value = "S U B M I T"/>... to upload the multiple images in struts Total images storing folder in project
How to upload multiple images in java(struts) using jsp?
How to upload multiple images in java(struts) using jsp?  I have jsp...="file" name="file[]" multiple/> <html:submit value = "S U B M I T"/>... to upload the multiple images in struts Total images storing folder in project
Advertisements
 

 

 

DMCA.com