Home Answers Viewqa JDBC jdbc and swing problem in netbeans

 
 


ram
jdbc and swing problem in netbeans
1 Answer(s)      a year and 8 months ago
Posted in : JDBC

i reteived the table from database in a jdbc program. next i want to do is place the table as it is in a jpanel.. i am using netbeans IDE can u tel me how to do that one?? urgent

View Answers

August 29, 2011 at 2:52 PM


import java.io.*;
import java.awt.*;
import java.sql.*;
import java.util.*;
import javax.swing.*;

class JTableDatabase extends JFrame{
    ResultSet rs;
    JTableDatabase(){
    final Vector columnNames = new Vector();
    final Vector data = new Vector();
    JPanel panel=new JPanel();
    try{
    Class.forName("com.mysql.jdbc.Driver");
    Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
    Statement st = con.createStatement();
    ResultSet rs= st.executeQuery("Select * from employee");
    ResultSetMetaData md = rs.getMetaData();
    int columns = md.getColumnCount();
    for(int i = 1; i <= columns; i++){
    columnNames.addElement(md.getColumnName(i));
    }
    while(rs.next()){
    Vector row = new Vector(columns);
    for(int i = 1; i <= columns; i++){
    row.addElement(rs.getObject(i));
    }
    data.addElement(row);
    }
   }
   catch(Exception e){}
   JTable table = new JTable(data, columnNames);
   JScrollPane scrollPane = new JScrollPane(table);
   panel.add(scrollPane);
   add(panel);
}
 public static void main(String arg[]){
    try{
    JTableDatabase frame=new JTableDatabase();
    frame.setSize(550,200);
    frame.setVisible(true);
    }
  catch(Exception e)
   {}
  }
}









Related Pages:
jdbc and swing problem in netbeans
jdbc and swing problem in netbeans  i reteived the table from database in a jdbc program. next i want to do is place the table as it is in a jpanel.. i am using netbeans IDE can u tel me how to do that one?? urgent
jdbc and swing problem in netbeans
jdbc and swing problem in netbeans  i reteived the table from database in a jdbc program. next i want to do is place the table as it is in a jpanel.. i am using netbeans IDE can u tel me how to do that one?? urgent
Java swing in NetBeans - Swing AWT
Java swing in NetBeans   thanks a lot sir for everything you answered.... i will specify a swing code for JTable using NETBEANS so would you tell me...=DriverManager.getConnection("jdbc:odbc:Stu","admin","admin"); try
jdbc problem
jdbc problem   hi my name is mohit...i am making a project in java.......i have made this code in netbeans...i have already entered the values..."); con = DriverManager.getConnection("jdbc:odbc:mohit"); stmt
problem in jdbc connection
problem in jdbc connection  when i am trying to insert into apache derby databse using java in netbeans an exceprion is thrown at run time like this:- java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver....what
jdbc oracle connectivity problem
jdbc oracle connectivity problem  Hi All, I am trying to connect my swing application to oracle DB . but class.forname is giving error. Please suggest me if there is some different way to connect swing application to oracle
java swing in netbeans
java swing in netbeans  how can create sub menu in java swing using netbeans?   Hi Friend, Try the following code: import javax.swing.*; public class CreateSubmenu { public static void main(final String args
oracle connectivity problem with netbeans
oracle connectivity problem with netbeans  sir I am using oracle window version +net bean6.8. jam trying to connect net bean to oracle. for this after adding new driver(ojdbc6.jar) in services tab I got connectivity with oracle
java,jdbc,netbeans
java,jdbc,netbeans  can you tell me the program which read multiple dbf files and then insert those dbf files data in msaccess automatically
problem in inserting data in databases created in netbeans using jsp..
problem in inserting data in databases created in netbeans using jsp.. ... created table inside netbeans through sql editor.and tried to make a login page whose... = DriverManager.getConnection("jdbc:mysql://localhost:3306/roseindia", "root", "root
jdbc - JDBC
what problem you faced and explain it in details and read more information on Netbeans and jdbc visit to : http://www.roseindia.net/jdbc/ http...."); Connection conn = null; String url = "jdbc:mysql://localhost:3306
struts 2 problem with netbeans - Struts
struts 2 problem with netbeans  i made 1 application in struts2 with netbeans but got one errror like There is no Action mapped for namespace... please give me acton mapping problem solution   Hi Friend, Please
SQL STATEMENT in JDBC in NETBEANS IDE
SQL STATEMENT in JDBC in NETBEANS IDE  Iam using NETBEANS IDE. Iam developing a bank application. Using JDBC in SERVLETS For the withdraw function, "bal" and "ano" are user inputs when i wrote like, st.executeQuery("UPDATE
coding problem in netbeans - Java Beginners
coding problem in netbeans  hi, i have just started programming in netbeans,i'm facing a problem in a java application i create a jframe class and jbutton and jtextfeild inside it now i have created another class c1
swing with jdbc - Swing AWT
have some problems with swing using jdbc. 1. the values entered in table are not stored in DB. 2. is there is any solution that uses jtable with JDBC? kindly...swing with jdbc  Hi, i m developing the desktop application using
Problem when resizing the form - Swing AWT
Problem when resizing the form  Hi, I am facing a problem when... part for JInternalFrame Form is (which is generated by the netbeans... The EditorPane(Old) overlaps the HeadPane(new). I think this problem is occuring whenever
New Problem in Form Resizing - Swing AWT
New Problem in Form Resizing  Hi, I am using a MDI application... for JInternalFrame Form is (which is generated by the netbeans in initcomponents...)); The problem is arising when the user resizes the form. The EditorPane(old
webservice in Netbeans
problem at 17 th step while right clicking on the source code im not getting..... im using netbeans version 6.9.1 .. pls help me out... regards-- Harish Kumar
Swing
Swing  Write a java swing program to search the details of the students. Searching is performed on studentā??s first name. The details of all those... in a table. Use JDBC
Swing
Swing  Write a java swing program to search the details of the students. Searching is performed on studentā??s first name. The details of all those... in a table. Use JDBC
Swing Problem on submission of button
Swing Problem on submission of button  How to close current frame (Frame1) and open a new frame (Frame2) already created and pass the data to frame2 from frame1 on the clicking of button in swing
Designing of textfield arrays in Netbeans IDE - Swing AWT
Designing of textfield arrays in Netbeans IDE  Respected sir, Sir I want to create an array of Jtextfield in Jframe Form in Swing GUI in NetBeans IDE.... How can i do this.........???? I have a code which
problem in swing-awt
problem in swing-awt  I am doing project in core java and i am facing one problem. I have to add command prompt(terminal) to the fream at bottom but not getting the solution. So please help me. thanks and regards, Aakash
JDBC related Problem - JDBC
JDBC related Problem  Hey plz check out the following code... = "jdbc:odbc:" + ds; try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver... connectivity code ...... my problem is... that even after the successful
Swing and AWT Problem - Swing AWT
Swing and AWT Problem  hi sir i have a problem i know from one Jframe we can send values to another Jframe. so in my project i have one fame containing three textfields CODE: String a=TNa.getText().toString(); String b
tooltip problem - Swing AWT
tooltip problem  Hi All, I am using SWT_AWT bridge in my code to embed swing components into SWT Composite. I am using a Swing JButton in SWT Composite. My problem is that I am unable to see the tooltip for this button even
swing frame problem
swing frame problem  Hi All, I m creating a swing/awt based window application which will take some data from user and according to that data it will display some information from DB to user etc.. Now when I will create
jdbc &swing - Java Beginners
jdbc &swing  I've used a progress bar in a database file upload window using swing.. But I can't set the uploading processing time with the progress bar.. please help me as early as possible.. How can I use progress bar against
problem with JTable - Swing AWT
problem with JTable  hi guys, i was a student and i am very new to swings.i was having an assignment like i need to create a JTable with checkboxes inside it.i do have another checkbox outside the Table.i need to write
connectivity problem
: oracle.jdbc.OracleDriver"" i am using this with netbeans since i have gain...=DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:XE","HR","HR
Java Problem Steps - Swing AWT
Java Problem Steps  How to create a Jar File From the Dos prompt of a Swing program having two classes in the program with one is public class one of them
printout problem
printout problem  Hi I have created a swing application which enter... = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root... information, visit the following link: http://www.roseindia.net/java/example/java/swing
Sitemap Java Swing Tutorial
Map | Business Software Services India JPA Tutorial Section JDBC vs... the JPA CRUD application | JPA CURD Application with NetBeans | JPA... in NetBeans | JPA Count Function | JPA executeUpdate | JPA delete data
uploading problem
uploading problem  i use glassfish server.. using netbeans for jsp...=DriverManager.getConnection("jdbc:odbc:DNSlib"); Statement st...(); } } } } %> my problem...: firstly
Multiple session problem - Swing AWT
Multiple session problem  I am working in a Linux based java swing application. Problem: I have optimized JDialog and JPanel for my use.... This problem is quite critical as UI looks quite unpredictable due
NetBeans
NetBeans  why Netbeans IDE is not commonly used Today by most of the companies
dsn problem - JDBC
me how to create dsn (jdbc ) at run time . when we will give our project... to remember to create dsn (jdbc): 1.Create an ODBC DSN Using the Windows... the driver To load the JDBC driver by calling the forName() static method
Servlet problem - JDBC
but however. It gives problem sometimes while at others it works perfectly. I m using jdbc-odbc driver. Can anybody help me plzzzz!!!!   Hi Friend
java programming problem - JDBC
java programming problem  Hi, Request you to provide the source code in Java for the following programming problem : upload .csv file data into oracle database. please send the solution to raichallp@yahoo.in
JSTL in Netbeans 6.9.1
JSTL in Netbeans 6.9.1  I am seeking your help in solving problem I am facing. The problem has been described below: I am using JSTL1.1 core tag... is working fine. I am using Netbeans 6.9.1 Id with Glassfish server 3 for my
LOGIN PROBLEM - JDBC
LOGIN PROBLEM   sir iam harikrishna studying B.Tech Fourth year sir... and passowrd then my problem is how can we write the code for validating the userid... with JSP AND JDBC can u plz.........send me the code for checking username
JDBC ODBC related problem
JDBC ODBC related problem  i WANT HELP RELATED TO JDBC CONNECTIVITY... con; con = DriverManager.getConnection("jdbc:odbc:Digambar... THE ERROR PART...... THE QUESTION N PROBLEM IS I WANT TO SELECTE PERTICULAR PAPER FROM
java swing problem - Java Beginners
java swing problem  i doesn't know about the panel in swings here i had created one frame then created a panel and i added that to my frame but which is not adding any item and it not showing that item on the panel tell me how
java swing (jtable)
java swing (jtable)  hii..how to get values of a particular record in jtable from ms access database using java swing in netbeans..?? please help... = DriverManager.getConnection("jdbc:odbc:roseindia"); String sql = "Select * from
NetBeans
NetBeans  Hi, I am Kundan I have made a project on NetBeans. And now I want to know that how can i run my project without NetBeans IDE,on other PC. Please help me it's important
NetBeans
NetBeans  Hi, I am Kundan I have made a project on NetBeans. And now I want to know that how can i run my project without NetBeans IDE,on other PC. Please help me it's important
binding jComboBox to mysql database - Swing AWT
binding jComboBox to mysql database  I am using netbeans 6.5 How...; Hi friend, code to help in solving the problem : import java.awt.... = null; String url = "jdbc:mysql://localhost:3306/"; String db
no driver - JDBC
no driver  i am having problem connecting to DB2 database fro netbeans: program: import java.sql.*; import java.lang.*; import java.io.... = "jdbc:db2:r_m"; String url = "jdbc:db2://localhost:50000/r_m
netbeans
netbeans  In netbeans, there are choices of books with their price. you check the book you wanted then click the purchase.the output should be the book with the price then you will get the total price of the book you purchase.how
java programming problem - JDBC
java programming problem  Hi, Request you to provide a solution ( analysis & design & unit test plan & code & test criteria ) to the following problem to the following mail id : Problem : upload excel file data into oracle

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.