-
datagrid
peace..
hey everybody
I m workin on a simple application with JAVA..nd I need to make an interface on which I v got to put some sql query results..I need some component like datagrid in VB..but I still don t find a free one..(just commercial)
are there some free component for that on swing or a tutoriel how to use them?
thanks
-
Have you looked at the JTable Class from the JDK?
-
What about building a simple HTML table?
-
Well..it s not a web application so I didnt think about using HTML tables...
but I m gonna try fisrt with the Jtabel component..
thanks for help
-
Frankly, I've never heard of an application which uses Java that isn't a web application. 
Anyway, let us know how it turns out.
-
Well..I m just beginner with java ..I mean that i m just trying to use a simple application with swing s component nd connect it with a datbase....
anyway thx for help!!!
-
Do you have it connecting with your database? (What database are you using?)
As far as this goes
 Originally Posted by peace_comp
I need some component like datagrid in VB..but I still don t find a free one..(just commercial)
Have a look at this.
-
maybe you can try jxcell,a java spreadsheet component
http://www.jxcell.net
-
thaks for the link..
I m using mysql ...
-
Are you any further ahead than you were when you first posted your question?
-
back...
well i used a simple JTable .. like the following code :
try { Vector data=new Vector ();
Vector col=new Vector ();
stat=con.createStatement();
String sql3="select * from name_table;
res=stat.executeQuery(sql3);
rsmd = res.getMetaData();
int nbr_colonne =rsmd.getColumnCount();
for (int i = 1; i <= nbr_colonne; i++) {
col.addElement(rsmd.getColumnName(i));
}
while (res.next())
{
Vector row = new Vector();
for (int i = 1; i <=nbr_colonne ; i++)
{
row.addElement(res.getObject(i));
}
data.addElement(row);
}
JTable tab=new JTable(v1,v2);
JScrollPane scr = new JScrollPane(tab);
....
}catch(Exception ex) {
JOptionPane.showMessageDialog(null, "Erreur"+ex, "Warning", JOptionPane.ERROR_MESSAGE);
}
}
**********************************************************
now the problem is how to refresh the JTable... if new data is added it must be displayed at the JTable//??
-
Take a look at this discussion, using methods for your TableModel:
http://www.programmersheaven.com/mb/...adMessage.aspx
-
thx.
well I have never use a TableModel .. so i don t know if it s already defined on a package or should I implemets the code ..
for example ..i saw in many tuto that they use directly the DefaultTabelModel..but when I try to use it:
DefaultTableModel mytab=new DefaultTableModel (v1,v2);// where v1 nd v2 are 2 Vectors..
it gives error because the constructor is not defined !!
so as I m new with java .. I don t really know how to implement it..I tied some code but it doesnt work..
plz if some one could tell me the goood way to do it ..or a tuto for that..
thanks
-
your table's getTableModel() method will return the tablemodel object which the JTable creates as a default if you do not tell the table to use another model.
The defaulttablemodel has implemented TableEvent listeners and table events ...
Take a look at the tutorial, now, knowing that you do not separately construct the DefaultTableModel.
Similar Threads
-
By bubberz in forum ASP.NET
Replies: 7
Last Post: 07-09-2006, 01:56 AM
-
By naijacoder in forum ASP.NET
Replies: 0
Last Post: 09-02-2005, 07:28 PM
-
By Webmaster in forum dotnet.announcements
Replies: 0
Last Post: 06-05-2003, 09:30 PM
-
By Thomas Eyde in forum .NET
Replies: 8
Last Post: 08-01-2002, 06:43 PM
-
Replies: 2
Last Post: 08-01-2002, 10:54 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|