plz help me
April 9, 2010 at 10:45 AM
Hi Friend,
Try the following code:
import java.sql.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class SwingFrame{
public static void main(String[] args) throws Exception{
SwingFrame sf=new SwingFrame();
}
public SwingFrame(){
JFrame f = new JFrame("Frame in Java Swing");
f.getContentPane().setLayout(null);
JLabel lbl1 = new JLabel("Name");
JTextField jt1=new JTextField(15);
JLabel lbl4=new JLabel("Branch");
final JComboBox jc=new JComboBox();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con =DriverManager.getConnection("jdbc:odbc:access","","");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("select name from course");
jc.addItem("Select");
while(rs.next()){
jc.addItem(rs.getString("name"));
}
}
catch(Exception e){}
lbl1.setBounds(100,120,70,20);
lbl4.setBounds(100,150,70,20);
jt1.setBounds(170,120,100,20);
jc.setBounds(170,150,100,20);
f.add(lbl1);
f.add(lbl4);
f.add(jt1);
f.add(jc);
f.setSize(1000,1000);
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
Thanks
Related Tutorials/Questions & Answers:
Advertisements
Acess Record from database.Acess Record
from database. How to access records
from database and how to display it on view page, with the help of hibernate
jComboBox with database my
database. But in my code its only get data
from first item which...
jComboBox with database Hello friends,
I have created three JComboBoxes. first two of them get list
from string. However I select these two
Database values in JComboBoxDatabase values in
JComboBox
In this section, you will learn how to display values in
JComboBox from
database. For this, we have allowed the user to enter any character as a key in
the textbox .Based on this key value, the results
from Help on database and JComboBoxHelp on
database and JComboBox I want to select
from the
JComboBox and when click onto the "search" button, the selected category (example "new york... the things
from database Link To Database with JComboBox - Java BeginnersLink To
Database with JComboBox sir As ur Source Code i have
Load course names
from Access
Database in to
JComboBox but now I want to do ,when i select Course name
from Jcombobox i want to display appropriate records relate
JComboBoxJComboBox I have
jcombobox. In which tha values are loaded
from MySql
Database. My problem is that i want to
load content of the jtable whenever i change the selected item. Please some one help me to do this.
Thank you
nsstring load from filensstring
load from file Hi,
How to
load file data into NSString object? Example of nsstring
load from file, basically the html file data into NSSTring object.
Thanks
jcomboboxjcombobox hi i have developed a form and i have
jcombobox in which data is retrieved
from ms access but the problem is that if we pressed the down key the last 5 data are not showed only the other data can be pressed
JComboBox have
jcombobox on Jframe form of IDE. In which the values are to be loaded
from MySql
Database. My problem is that i want to
load content of the jtable whenever i change the selected item in
JComboBox.
Thank you.
(adsbygoogle
How to store JComboBox item into database How to store
JComboBox item into
database import... DefaultComboBoxModel(labels);
final JPanel TypeTF = new JPanel();
JComboBox comboBox1 = new
JComboBox(model);
comboBox1.setEditable(false
binding jComboBox to mysql database - Swing AWTbinding
jComboBox to mysql database I am using netbeans 6.5
How to populate
jComboBox with data of specific column of mysql
database table?
I... = st.executeQuery("SELECT *
FROM userform");
while (res.next
Migrating from mysql to MS AccessMigrating
from mysql to
MS Access Hi
I am hoping for some help
I need to write a conversion program (SQL statements) to import existing data in a MYSQL
database to a
MS Access
database.
any suggestions would be appreciated
JComboBoxJComboBox I want to change the index of one
jComboBox according to the selected index of another
jComboBox. I can do it.Also the user should have the ability to select or change the index of the second combobox according
jComboBoxjComboBox I want to change the index of one
jComboBox according to the selected index of another
jComboBox. I can do it.Also the user should have the ability to select or change the index of the second combobox according
JcomboboxJcombobox Hii,
I am doing my final year project and i am using java swing as a front end.I have used
Jcombobox for displaying my on bluetooth devices and i also made a refresh button.when i click on the refresh button i
applet connected to table in MS Access database applet connected to table in
MS Access
database i have connected my java code with the
MS access
database and this is my code, can anyone tell me...) {
//step 1:
load driver
loadDriver();
//step 3: establish connection
How to load file from the directory in J2ME?How to
load file
from the directory in J2ME? Video player J2ME.
I have a folder name "music". I want to display all file with extension is "*.mpg" on the List.
How can I do it, plz help me
regarding ms acces database and servlet - JDBCregarding
ms acces
database and servlet hello there,
i am trying to do a web application that makes use of a data base. I opted for
ms access..... ) properly but when i tried to do the same kind of
database access
from how to access the MS ACCESS database with java how to access the
MS ACCESS
database with java how to access the
MS ACCESS
database with java how can we insert,delete,update,search records of
ms access with java
Java
MS Access
database connectivity
Follow
selecting data from databaseselecting data
from database how to select data
from database using Dao in struts
Hi,
You have to
load the data
from database using hibernate and send the data in a Java file object to jsp page.ADS_TO_REPLACE_1
How to remove paragraph from ms wordHow to remove paragraph
from ms word Hi! I am using
MS Word to edit my text but somehow i get paragraph sign on every line of my text. So, can any one please tell me how to remove paragraph
from ms word?
CTRL+SHIFT+8
how to connect to MS access database in JSP?how to connect to
MS access
database in JSP? how to connect to
MS access
database in JSP? Any seetings/drivers need to be set or installed before...();
ResultSet rs=st.executeQuery("select *
from data");
while(rs.next()){
%>
<