|
| ||||||||||
| Tags: class, java, java class, java classes, java jtable class, jtable, jtable class, jtable class concept |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| What is the use of JTable class?
I am learning advanced java programming. This programming sounds very difficult to understand than C++ programming. I need you help to know about the 'class JTable'. This class is something related to creating table java, and this is the only which I know about JTable class. If you have knowledge about the JTable class of java, then please let me know the same. I would greatly appreciate your any help. |
|
#2
| ||||
| ||||
| Re: What is the use of JTable class?
The JTable is used to display and edit regular two-dimensional tables of cells. The JTable has many facilities that make it possible to customize its rendering and editing but provides defaults for these features so that simple tables can be set up easily. Note that if you wish to use a JTable in a standalone view (outside of a JScrollPane) and want the header displayed, you can get it using getTableHeader() and display it separately. |
|
#3
| ||||
| ||||
| Re: What is the use of JTable class?
Hi friend, I have one example of java which will demonstrate you the use of JTable class: Code: import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
public class JTableDemo {
public static void main(String args[]) {
JFrame frp = new JFrame();
frp.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Object rowData[][] = { { "Row1-Column1", "Row1-Column2", "Row1-Column3" },
{ "Row2-Column1", "Row2-Column2", "Row2-Column3" } };
Object columnNames[] = { "Column One", "Column Two", "Column Three" };
JTable table = new JTable(rowData, columnNames);
JScrollPane scrollPane = new JScrollPane(table);
frp.add(scrollPane, BorderLayout.CENTER);
frp.setSize(200, 150);
frp.setVisible(true);
} |
|
#4
| ||||
| ||||
| Re: What is the use of JTable class?
The JTable class of java is basically used for to create tables. Following are some constructors of the JTable class:
|
|
#5
| ||||
| ||||
| Re: What is the use of JTable class?
I have coded one java example using JTable class. When you run below code, it will create table with 12 rows and 6 columns: Code: import javax.swing.JTable;
import javax.swing.JScrollPane;
public class TJDemo
{
public static void main(String[] argt)
{
JTable tnl = new JTable(12, 6);// it will create a table with 12 rows and 6 columns
JScrollPane scrollPane = new JScrollPane(tnl);
}
} |
|
#6
| ||||
| ||||
| Re: What is the use of JTable class?
Hi, Below are some methods of JTable class of java, please go through them:
|
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "What is the use of JTable class?" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Editing JTable cells | Messenger | Software Development | 5 | 29-07-2010 10:31 AM |
| Fill JTable with several values | Logan 2 | Software Development | 5 | 19-01-2010 01:39 PM |
| Print JTable with the help of java | Coldman | Software Development | 3 | 25-11-2009 08:02 AM |
| How to retrieve data from a jTable in Java and MS access | Corona | Software Development | 3 | 09-07-2009 11:59 AM |
| How to refresh data of Jtable in java | sarmad_iu | Software Development | 1 | 28-05-2009 02:45 PM |