Home Answers Viewqa Java-Beginners Create a Table in Java

 
 


juju
Create a Table in Java
1 Answer(s)      5 years and 3 months ago
Posted in : Java Beginners

How can i create table in Java?

View Answers

March 17, 2008 at 8:34 PM


Java Example Code - Creating table in JAVA
- - - - - - - - - - - - - - - - - - - - - -

Hi, here i am giving you a java program code, that creates a table with two columns and 6 rows using java programming language!

Code
-----

CreateTable.java

import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;

public class CreateTable{
JTable table;
public static void main(String[] args) {
new CreateTable();
}

public CreateTable(){
JFrame frame = new JFrame("Create table in java");
JPanel panel = new JPanel();
String data[][] = {{"Vinod","Computer"},
{"Ravi","Computer"},
{"Deepak","Biology"},{"Santosh","Photoshop"},{"Amardeep","MCA"},{"Suman","MCA"}};
String col [] = {"Name","Course"};
DefaultTableModel modeltable = new DefaultTableModel(data,col);
table = new JTable(modeltable);
Dimension dimen = new Dimension(20,1);
table.setIntercellSpacing(new Dimension(dimen));
SetRowHight(table);
table.setColumnSelectionAllowed(true);
JTableHeader head = table.getTableHeader();
head.setBackground(Color.pink);
JScrollPane pane = new JScrollPane(table);
panel.add(pane);
frame.add(panel);
frame.setSize(500,230);
frame.setUndecorated(true);
frame.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
public void SetRowHight(JTable table){
int height = table.getRowHeight();
table.setRowHeight(height+10);
}
}
-----------------------









Related Pages:
Create a Table - Java Beginners
Create a Table in Java  How can i create table in Java?  Java Example Code - Creating table in JAVA- - - - - - - - - - - - - - - - - - - - - - Hi, here i am giving you a java program code, that creates a table with two
Java Table Create
Java Table Create  hi........ thanks 4 ur reply......... but i... and then avalues in front of them. Eg: suppose the following is the table..., temp etc should also come in that table............. so plz tel me how
how to create a table
how to create a table  create table tablename (name varchar(10),name.... Use the following query: create table tablename (name varchar(10),address varchar(10)); For more information, visit the following link: Java Create
Create Dynamic Table using Hubernate
Create Dynamic Table using Hubernate  Thank's for reading my Post. I...: How to create seperate table for all users they sign up for my web app. i need to create 2 table's 1.User Details - Store user mail address,username
create table in mysql of split file created in java
create table in mysql of split file created in java  i have created splite file in java. now i want to create table from splited data how to do
JDBC: Create Table Example
JDBC: Create Table Example In this section, we are going to create table using JDBC and using database MySql. Create Table : Database table is collection... are creating table, named student in the database. For that we create
Java create table in html file
Java create table in html file In this section, you will learn how to create table in html file. In the previous section, you have seen different operations... as an argument. Now we have used the html table tag to create a table in html file
How to read textfile and create SQL server table ?
How to read textfile and create SQL server table ?  hi sir, your site... trying to read textfile and create table in sql server but it gives error.../questions/16415498/creating-a-table-in-sql-database-by-reading-textfile-in-java
How to Create Multiplication Table from 1 to 10?
How to Create Multiplication Table from 1 to 10?  Hi, I want to develop an small application store products. So, i how to create multiplication... table. Thanks   Hi, Did you want to create multiplication table 1
how tohow to create a table with primary key and foreign keyhow to create a table with primary key and foreign key
how tohow to create a table with primary key and foreign keyhow to create a table with primary key and foreign key  how to create a table using.... CREATE TABLE CUSTOMER (SID integer, FirstName varchar(40), LastName varchar(40
Java to create table in jsp file that include other jsp file
Java to create table in jsp file that include other jsp file  String jspContent = "table" += "tr" += "td" += "jsp:include page='fileSource'" //this line is not working properly... += "/td" += "/tr>" += "/table" Please refer
Using poi hwpf,how to create table in word document. - Java Beginners
Using poi hwpf,how to create table in word document.  Can you please tell me how to create a table in the word document in java using Apache poi hwpf.its very urgent.Please send some sample code.Thanks in advance
syntax for create a table
syntax for create a table  syntax for create a table
How To Create a Table.
How To Create a Table.  How To Create a Table?   Hi friends, If you want to create a table, you can run the CREATE TABLE statement..._config.php"; $sql = "CREATE TABLE user_info(" . " id INTEGER NOT NULL" . ", name
Table
Table  How i create table on showMessageDialog using JOptionpane and Integer.parseInt. No other method to use. Pl make a program which generate 5X1=5 5X2=10 5X3=15   Hi Friend, Try this: import javax.swing.*; import
Create Multiplication Table from 1 to 10
Create Multiplication Table in Java In this section, you will learn how to create multiplication table from 1 to 10. For this purpose, we have created 2-dimensional Array 'array[][]' and using the for loop, we have stored the product
Java Hash table
Java Hash table   Hi I have to create code to allow the insertion of a sequence of numbers into a hash table,using a fixed size hash table. Then i... of numbers; insert these into the hash table. Can anyone give me any help
create
create  how to create an excel file using java
Create table and insert data by sql query
Create table and insert data by sql query       This is detailed java program to connect java application and execute sql query like create table in mysql
creation of table using a Java swing
creation of table using a Java swing  how to create a table dynamically in Java swing
java coding for creating table in the console
java coding for creating table in the console  write a java program to create table
alter table create index mysql
alter table create index mysql  Hi, What is the query for altering table and adding index on a table field? Thanks
What is the syntax for a CREATE TABLE statement?
What is the syntax for a CREATE TABLE statement?  What is the syntax for a CREATE TABLE statement
MySQL Create Table
MySQL Create Table       Here, you will read the brief description about the MySQL create table. The CREATE TABLE statement is used for creating a table in database. 
Creating a Hash Table
Creating a Hash Table : Java Util   ... table. What is the hash table and how to create that? Hash Table holds... for several values. Hash Table is created using an algorithm (hashing function
Create a Table in Mysql database through SQL Query in JSP
; This is detailed java code to connect a jsp page to mysql database and create a table of given... Create a Table in Mysql database through SQL Query in JSP... named 'usermaster' in mysql and create table "user_master". Create
alter table create index mysql
alter table create index mysql  Hi, What is the query for altering table and adding index on a table field? Thanks   Hi, Query is: ALTER TABLE account ADD INDEX (accounttype); Thanks
Create PDF from java
code to create pdf file from database call from java programming. thank you, Hendra   Create PDF from Java import java.io.*; import java.sql....Create PDF from java  Good afternoon, I have a problem how to create
Java program to create a frame with 4 fields;name,sreet,city,pin;with suitable table
Java program to create a frame with 4 fields;name,sreet,city,pin;with suitable table  Java program to create a frame with 4 fields;name,street,city,pin;with suitable table. Also add a button "OK". whe it is clicked
JDBC Drop Table Example
Table from Database. This tutorial  first  create database "testjdbc" if not exist and create a table "user" under "...  we create "DropTable.java " class that used for drop table. We
Mysql Create Table
Mysql Create Table       Mysql Create Table is used to create a table in database. Understand with Example The section of Tutorial will help you to create a table in database
Create Table in SWT
Create Table in SWT       In this section, you will study how to create a table. SWT provides... to create a table. In the given example, we have create an ArrayList of Tennis players
To write a Java program To create a frame with 4 fields;name,street,city,pin;with suitable table
To write a Java program To create a frame with 4 fields;name,street,city,pin;with suitable table  I want to write a Java program To create a frame with 4 fields;name,street,city,pin;with suitable table
Creation and insertion in table
CREATION OF  TABLE,INSERTION &DISPLAY OF DATA  USING SQL QUERY   In this progam we create table in MYSQL using "create"... a data base.     String QueryString = "CREATE TABLE user1 (User_Id INTEGER
PHP How to Create Table
PHP Create Table: In every database we need to create table, tables... by a row. To create a table we need to create a database first and then open... opening the database we can create table by one of the  following way
Time table generation
Time table generation  Hi I am 3rd year bca student i want create time table generator for my project.i am going to create it as school time table... gave me i can't understand it fully, in that i understood we can create table
Table generation error - EJB
Table generation error  Hi friends I am using EJB3.0 with sun java... "CREATE TABLE BookShop (ID INTEGER NOT NULL, BOOKNAME VARCHAR(255), AUTHOR VARCHAR... an EJB it gives the following exception and doesnt generate any table
How we can create a table through procedure ?
How we can create a table through procedure ?  How we can create a table through procedure
table in java
table in java  please l want to make table and insert by user
how to take input table name in jsp to create table in mysql?
how to take input table name in jsp to create table in mysql?  how to take input table name in jsp to create table in mysql?   Hello Friend...="submit" value="Create Table"> </form> <% String tab
table in java
table in java  Could any one make compiler in java please reply me
table in java
table in java  Could any one make compiler in java please reply me
table in java
table in java  Could any one make compiler in java please reply me
jtable with table headers - Swing AWT
jtable with table headers  give me java code to create jtable with table headers and by which i can scroll jtable and can retrieve height and width of the table
Joining Multiple table in Hibernate
Joining Multiple table in Hibernate  Hi everyone, I'm new to Hibernate (even in JAVA), and I'm having some doubt's about one thing. I created 2... to idPessoa on TbPessoa). I'm trying to create a query where I would get the items
how to create database and table using jsp
how to create database and table using jsp  hi frnds...., i want to create database and table in mysql using jsp.... i have an registration form(name,sex,address,phone and so on ... ) i want to create individual table in mysql
Adding a Reports tap in table pool
Adding a Reports tap in table pool  strong textHow to write a code to create a report in java using eclipse and link that report in jsp file that is written in jsf. I have to edit a jsp file that is written jsf there is a table
create MS Word in Java - Java Beginners
create MS Word in Java  Hi, Could any one please post the code which... everywhere. But i need to write more to the document like Table inserting values init... which creates MS Word in Java
pdf Table title
a object of PdfPTable class. It will create a table with 2 rows and 2 columns... pdf Table title      ... to the table of the pdf file. Suppose we have one pdf file in which we have a table and we
Inserting a value to an Enum field in Table
that creates a user account and sends the result to the user table in a mysql database. For example, in the user table I have: username varchar(15) PRIMARY KEY, password varchar (10), is_Admin enum('Y','N'), In the Java code I have a user

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.