Sir,
I created one JTable with two columns and one row i have given two values,but i getting only one value .That is a[1][1] is String array. if i have given 8,9 then i got 8 only but not 9.i.e a[0][0]=8
a[0][1]= (nothing printed)
Please go through my code
import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.*;
import java.awt.print.*;
import java.sql.*;
public class sd25 extends JFrame implements ActionListener
{
//3 month table details
JTable table=null;
JScrollPane js=null;
Container cp=null;
JPanel p=null;
JLabel months3=null,date=null,ghba1c=null,per=null;
JButton jb1=null;
String a[][]=new String[2][2];
Connection con=null;
Statement stmt=null;
ResultSet rs=null;
public sd25()throws Exception
{
cp=getContentPane();
cp.setLayout(null);
cp.setBackground(Color.pink);
//3monts details
months3=new JLabel("3 Months-Report");
date=new JLabel("Date");
ghba1c=new JLabel("GHbA1c");
per=new JLabel("%");
final Object colheads[]={"Date","%"};
final Object rowdata[][]={{"",""},{"",""}};
table=new JTable(rowdata,colheads);
p=new JPanel(null);
months3.setBounds(40,10,300,40);
date.setBounds(190,20,300,40);
ghba1c.setBounds(400,20,300,40);
per.setBounds(470,20,300,40);
table.setBounds(100,50,460,15);
jb1=new JButton("submit");
jb1.setBounds(790,400,100,40);
int h=ScrollPaneConstants.HORIZONTALSCROLLBARAS_NEEDED;
int v=ScrollPaneConstants.VERTICALSCROLLBARAS_NEEDED;
jb1.addActionListener(this);
cp.add(per);
cp.add(ghba1c);
cp.add(date);
cp.add(months3);
cp.add(table);
cp.add(jb1);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent we)
{
dispose();
//System.exit(0);
}
});
}
public void actionPerformed(ActionEvent ae)
{
System.out.println("hi");
if(ae.getSource()==jb1)
{
try
{
for(int i=0;i<1;i++)
{
for(int j=0;j<=1;j++)
{
for(int i=0;i<1;i++)
{
for(int j=0;j<=1;j++)
{
System.out.println("\n"+i+""+j+""+a[i][j]);
}
}
Related Tutorials/Questions & Answers:
JTable values are not gettiing properlyJTable values are not
gettiing properly Sir,
I created one
JTable with two columns and one row i have given two
values,but i getting only one... details
JTable table=null;
JScrollPane js=null;
Container cp=null;
JPanel p=null
Advertisements
sum of all values in a column of jtable,
is there a code to display the sum of all
values in a column of a
jtable namely CARTtbl... or deleted.
Here is an example of
jtable that sums up the
values of two...("Setting Cell
Values in
JTable");
JPanel panel = new JPanel();
Integer data
Setting Cell Values in JTable
Setting Cell
Values in
JTable
...
values in
JTable component. For this you must have the some previous knowledge... will see the process of
setting the cell
values in
JTable. This program sets
Getting Cell Values in a JTable
Getting Cell
Values in a
JTable
...
values in a
JTable component. It is a same as setting the cell
values in
a
JTable...
This program helps you to get the cell
values in a
JTable.
This program creates a
JTable JTableJTable
Values to be displayed in JTextfield when Clicked on
JTable Cells
JTableJTable i want to delete record from
JTable using a MenuItem DELETE. and
values of
JTable are fetched from database....please reply soon
How to update,Delete database values from jtable cells ..How to update,Delete database
values from
jtable cells .. hello Sir... from database into
jtable of a jpanel.. Now Sir, According to my need i have to update the cell
values from there only means that whatever
values i ma entering
JTableJTable need to add
values to a
JTable having 4 coloumns ,2 of them are comboboxes
jtablejtable hey i have build a form and i m also able to add data from database to
jtable along with checkbox.the only problem is that if i select... checkbox is selected it works
properly. plzz help..itz urgent
jtablejtable hi
Sir
i am working netbeans IDE,I have a
jtable when i insert
values in
jtable
then i am unable to print all inserted
values,For eg if i insert 1,2,3,4,5,6,7,8
values
then , i am getting output
jtablejtable how to get the
values from database into
jtable and also add a checkbox into it and then when selected the checkbox it should again insert into database the selected chewckbox.plzz help
JTableJTable Hi
I have problems in setting
values to a cell in
Jtable... method
tableChanged(TableModelEvent e) .
I'll be loading
values from data base when i enter id in a column. and i want to load other table columns the
values JTable JTable how to select a definite cell which containing a similar text containg to the one which the user entering from a
jtable at runtime in java
JTableJTable Hello, i cannot display data from my table in the database to the cells of my
JTable. please help me
JTable"};
JTable table=new
JTable(data,labels);
JScrollPane pane=new JScrollPane
Swings JTableSwings JTable add
values to
JTable with four coloums,two of them are comboboxes
JTABLE IssueJTABLE Issue Hi Eveyone,
I am developing a small application on Swing-AWT. I have used
JTABLE to show data. There is "input field" and "search... on basis of input data provided in input field. For
JTABLE is on some other
java jtable in which i have to display database records in
jtable .now I want to read only the
values of particular row at which the jtextfield has been set. and display that in
jtable.
plz help me with the code
JTable - Swing AWTJTable Hi Deepak,
i m facing a problem with
jtable. i am able to display the
values from the database into the
jtable. but not able to modifying multiple cell
values in a row. also i want to store those modified
JTABLE OF JAVAJTABLE OF JAVA i have a
jtable in java,i have used checkbox in
jtable.
now i want to add(submit) only those records that i have checked by checkbox how?
i want small example with coding
Jtable-JavaJtable-Java Hi all,I have a
Jtable And i need to clear the data in the table .I only Need to remove the data in the table.not the rows.Please help me
Jtable with servlet - Java BeginnersJtable with servlet
Actually I have embedded the html... and will submit the
values which will be saved in the database(MySql).At the same time I want the
JTable to display the record saved in the database,the
JTable sum in JTablesum in JTable how to calculate sum from
JTable's one field like total
jtable queryjtable query I need a syntax...where i could fetch the whole data from the database once i click the cell in
jtable...and that must be displayed in the nearby text field which i have set in the same frame
regarding jtable...regarding
jtable... sir,
im working with jtables. i wanted to populate a
jtable from the database and when i click any row it should add a container... a container on the
jtable.
kindly help me sir.
thanks in advance
regards,
rajahari
ABOUT JtableABOUT Jtable My Project is Exsice Management in java swing Desktop Application.
I M Use Netbeans & Mysql .
How can retrive Data in
Jtable from Mysql Database in Net Beans
How to insert rows in jTable?How to insert rows in
jTable? Hi,
I need to take input from user using
JTable. I want an empty row to appear after clicking a insert button. The
values will be entered in this empty row. I have searched on this but could
output not coming properly - JSP-Servletoutput not coming properly I am not getting the output
properly when i had written my code like below:
Add Employee Details
for( j=0;j<11;j++)
{
out.println("Department code
jtable insert row swingjtable insert row swing How to insert and refresh row in
JTable?
Inserting Rows in a
JTable example
jtable in java swingjtable in java swing hai friends...
i am creating 1 GUI having 1 table, that table contain 3 fields(columns) and 10 rows..
user can enter
values... entering the
values in d 2nd column the user hit on the enter button.then the focus
REPORT WITH JTABLE(Exception e){}
JTable table = new
JTable(data, columnNames);
JScrollPane scrollPane
JTable - JDBCJTable
Hello.....
I have
Jtable with four rows and columns and i have also entered some records in MsSql database. i want to increase
Jtable's...
{
JFrame f;
JPanel p;
JLabel l;
JTextField tf;
JButton btn;
JTable tb
JTable - Swing AWTJTable row selection event Hi, it will be great if someone can share an example of row selection event in
JTable Connecting JTable to database - JDBC(){
JFrame frame = new JFrame("Getting Cell
Values in
JTable");
JPanel...Connecting
JTable to database Hi..
I am doing a project on Project... to store this
JTable content in my database table..
This is a very important
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... from database and display it in
jtable.
import java.awt.*;
import java.sql.