473,386 Members | 1,832 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,386 software developers and data experts.

swing tables

1
i have a swing table with 8 columns and many rows.I am populating data from database.I got all the data in resultset.but i need the data to be displayed in different rows.Can any one be of any help to me..Am using a vector.The code snipet is like ..
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:new","s a","");
Vector data = new Vector();
st=con.createStatement();
rs=st.executeQuery("SELECT * FROM Table1 where name='dsadas'");
int index = 1;

while(rs.next()){
data.addElement(rs.getString(index++));
data.addElement(rs.getString(index++));
data.addElement(rs.getString(index++));
data.addElement(rs.getString(index++));
data.addElement(rs.getString(index++));
model.addRow(data);

}

But i need the data to be displayed in different rows...Thanks in advance
Aug 3 '07 #1
1 1098
JosAH
11,448 Expert 8TB
But i need the data to be displayed in different rows...Thanks in advance
If you have a JTable you should have a TableModel that can produce
elements of the table. Have a look at the AbstractTableModel class that
implements almost everything for you. Extend this class and feed it to your
JTable class; that's all there is to it.

kind regards,

Jos
Aug 3 '07 #2

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

Similar topics

5
by: Chris | last post by:
Having been traumatised many years ago when using MFC/C++ to develop front-end code, I've religiously avoided GUI work since and stuck to back-end / server-side projects. So I'm a bit of a novice...
6
by: Joseph | last post by:
hi 1) i plan on having an awt canvas component (to draw graphs) on a JFrame with other swing components..will this be okay? i've read that swing and awt aren't compatible.. 2)Also, if i...
3
by: bergel | last post by:
Hello, Does anyone already have some experience in mixing AWT and Swing? Is it conceptually doable? Does the design of Swing prevent interaction between an AWT and a Swing widget? Regards,...
3
by: Sherrod Faulks | last post by:
I'm using Jython and in the python script I do: from javax import swing result = javax.swing.JOptionPane.showInputDialog(wC, cmd,"Prompt from " + client.serverName, JOptionPane.PLAIN_MESSAGE) ...
1
by: nellu | last post by:
i need a help. i have 2 tables in MS Access one Java swing Program. my program retrives the values from one table and after some calculation the final result will be inserted into another table....
3
by: Nuwang | last post by:
Hai, I'm using a swing to connect database with swing application... 1. How this swing connect with access database... 2. Important thing is how change Button size and Font size Still I...
0
by: rejithes | last post by:
Hi, I had an application in which database swing will happen automatically. Some of my tables have field datatype - TEXT. It is found that the TEXT datatype is getting corrupted after database...
1
by: svineeths | last post by:
I want to get data into a swing table from database.Can you please help me.
6
by: r035198x | last post by:
I have put together this article to give people starting Swing an awareness of issues that need to be considered when creating a Swing application. Most of the Swing tutorials that I have seen just...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...

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.