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

How can i retrive data from table using java swings

import java.util.*;
import java.awt.*;

import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.*;
import java.awt.print.*;
public class sd7 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;


//6 month table details
JTable table1=null;
JLabel months6=null,date1=null,tgl=null,ldl=null,tchl=nul l,hdl=null,vldl=null,date2=null,mau=null,remarks=n ull;
JLabel lipidsand=null,mau1=null;



//12months

JLabel cxr=null,ecg=null,fundus=null,months12=null;
JTextArea jt1=null,jt2=null,jt3=null;
//RFT details
JTable table2=null;
JLabel rft=null,sc=null,bu=null,bun=null,lft=null,tbil=nu ll,sgot=null,sgpt=null,alkp=null,date3=null,hb=nul l;



public sd7()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("%");



//6monts details
months6=new JLabel("6 Months-Report");
date1=new JLabel("Date");
tgl=new JLabel("TGL");
tchl=new JLabel("T chl");
hdl=new JLabel("HDL");
ldl=new JLabel("LDL");
vldl=new JLabel("VLDL");
date2=new JLabel("Date");
mau=new JLabel("MAU");
remarks=new JLabel("Remarks");
lipidsand=new JLabel("Lipids and");
mau1=new JLabel("MAU");




//3 monts details
String a[][]=new String[2][2];
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,80);
jb1=new JButton("submit");
jb1.setBounds(790,400,100,40);
int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEED ED;
int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED ;



jb1.addActionListener(this);
cp.add(per);
cp.add(ghba1c);
cp.add(date);
cp.add(months3);
cp.add(table);
cp.add(jb1);










//6months details

final Object colheads1[]={"Date","Tchl","TGL","HDL","LDL","VLDL","DATE","M AU","REMARKS"};
Object rowdata1[][]={{"","","","","","","","",""},{"","","","","","", "","",""},{"","","","","","","","",""},{"","",""," ","","","","",""},{"","","","","","","","",""} };
table1=new JTable(rowdata1,colheads1);
int h1=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEE DED;
int v1=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDE D;
table1.setBounds(65,200,500,80);

months6.setBounds(40,145,300,40);
date1.setBounds(80,170,300,40);
tchl.setBounds(140,170,300,40);
tgl.setBounds(200,170,300,40);
hdl.setBounds(250,170,300,40);
ldl.setBounds(307,170,300,40);
vldl.setBounds(350,170,300,40);
date2.setBounds(410,170,300,40);
mau.setBounds(470,170,300,40);
remarks.setBounds(512,170,300,40);
lipidsand.setBounds(5,190,200,40);
mau1.setBounds(30,204,300,40);
cp.add(table1);
cp.add(months6);
cp.add(date1);
cp.add(tchl);
cp.add(tgl);
cp.add(hdl);
cp.add(ldl);
cp.add(vldl);
cp.add(date2);
cp.add(mau);
cp.add(remarks);
cp.add(lipidsand);
cp.add(mau1);





//12 months
months12=new JLabel("12 Months-Report");
months12.setBounds(40,290,140,30);


cxr=new JLabel("CXR",JLabel.RIGHT);

cxr.setBounds(10,350,140,30);
jt1=new JTextArea(100,380);
jt1.setBounds(150,350,400,70);

ecg=new JLabel("ECG",JLabel.RIGHT);
ecg.setBounds(10,450,140,30);
jt2=new JTextArea(100,380);
jt2.setBounds(150,450,400,70);


fundus=new JLabel("Fundus",JLabel.RIGHT);
fundus.setBounds(10,550,140,30);
jt3=new JTextArea(100,380);
jt3.setBounds(150,550,400,70);

cp.add(months12);
cp.add(cxr);
cp.add(jt1);
cp.add(ecg);
cp.add(jt2);
cp.add(fundus);
cp.add(jt3);
//rtf Report
final Object colheads2[]={"RFT","SC","BU","BUN","LFT","TBIL","SGOT","SGPT" ,"ALKP","DATE","HB"};
Object rowdata2[][]={{"","","","","","","","","","",""},{"","","","", "","","","","","",""}};
table2=new JTable(rowdata2,colheads2);
table2.setBounds(30,700,500,30);
rft=new JLabel("R.F.T");
rft.setBounds(35,680,500,30);
cp.add(rft);
sc=new JLabel("SC");
sc.setBounds(90,680,500,30);
cp.add(sc);
bu=new JLabel("BU");
bu.setBounds(135,680,500,30);
cp.add(bu);
bun=new JLabel("BUN");
bun.setBounds(175,680,500,30);
cp.add(bun);



lft=new JLabel("L.F.T");
lft.setBounds(225,680,500,30);
cp.add(lft);


tbil=new JLabel("T.BIL");
tbil.setBounds(270,680,500,30);
cp.add(tbil);

sgot=new JLabel("SGOT");
sgot.setBounds(312,680,500,30);
cp.add(sgot);

sgpt=new JLabel("SGPT");
sgpt.setBounds(357,680,500,30);
cp.add(sgpt);

alkp=new JLabel("ALK.P");
alkp.setBounds(405,680,500,30);
cp.add(alkp);

date2=new JLabel("Date");
date2.setBounds(452,680,500,30);
cp.add(date2);
hb=new JLabel("Hb");
hb.setBounds(503,680,500,30);
cp.add(hb);





cp.add(table2);

addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent we)
{
dispose();
//System.exit(0);
}
});
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==jb1)
{
//cp.setBackground(Color.red);
try
{

//PrinterJob printJob =PrinterJob.getPrinterJob();
//printJob.setPrintable(this);
Toolkit toolkit = this.getToolkit();
PrintJob printJob1 = toolkit.getPrintJob(this, "", null);
Graphics g = printJob1.getGraphics();
this.print(g);
printJob1.end();

/*if (printJob1.printDialog())
try {
printJob.print();
} catch(PrinterException pe) {
System.out.println("Error printing: " + pe);
}*/
// proj1 o=new proj1();
// dispose();
// o.start();
// o.pack();
// o.setSize(1600,1600);
// o.show();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
public static void main(String args[])throws Exception
{
sd7 o=new sd7();
o.setSize(900,900);
o.show();
}
}
Nov 28 '10 #1
1 2798
import java.util.*;
import java.awt.*;

import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.*;
import java.awt.print.*;
public class sd7 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;


//6 month table details
JTable table1=null;
JLabel months6=null,date1=null,tgl=null,ldl=null,tchl=nul l,hdl=null,vldl=null,date2=null,mau=null,remarks=n ull;
JLabel lipidsand=null,mau1=null;



//12months

JLabel cxr=null,ecg=null,fundus=null,months12=null;
JTextArea jt1=null,jt2=null,jt3=null;
//RFT details
JTable table2=null;
JLabel rft=null,sc=null,bu=null,bun=null,lft=null,tbil=nu ll,sgot=null,sgpt=null,alkp=null,date3=null,hb=nul l;



public sd7()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("%");



//6monts details
months6=new JLabel("6 Months-Report");
date1=new JLabel("Date");
tgl=new JLabel("TGL");
tchl=new JLabel("T chl");
hdl=new JLabel("HDL");
ldl=new JLabel("LDL");
vldl=new JLabel("VLDL");
date2=new JLabel("Date");
mau=new JLabel("MAU");
remarks=new JLabel("Remarks");
lipidsand=new JLabel("Lipids and");
mau1=new JLabel("MAU");




//3 monts details
String a[][]=new String[2][2];
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,80);
jb1=new JButton("submit");
jb1.setBounds(790,400,100,40);
int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEED ED;
int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED ;



jb1.addActionListener(this);
cp.add(per);
cp.add(ghba1c);
cp.add(date);
cp.add(months3);
cp.add(table);
cp.add(jb1);










//6months details

final Object colheads1[]={"Date","Tchl","TGL","HDL","LDL","VLDL","DATE","M AU","REMARKS"};
Object rowdata1[][]={{"","","","","","","","",""},{"","","","","","", "","",""},{"","","","","","","","",""},{"","",""," ","","","","",""},{"","","","","","","","",""} };
table1=new JTable(rowdata1,colheads1);
int h1=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEE DED;
int v1=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDE D;
table1.setBounds(65,200,500,80);

months6.setBounds(40,145,300,40);
date1.setBounds(80,170,300,40);
tchl.setBounds(140,170,300,40);
tgl.setBounds(200,170,300,40);
hdl.setBounds(250,170,300,40);
ldl.setBounds(307,170,300,40);
vldl.setBounds(350,170,300,40);
date2.setBounds(410,170,300,40);
mau.setBounds(470,170,300,40);
remarks.setBounds(512,170,300,40);
lipidsand.setBounds(5,190,200,40);
mau1.setBounds(30,204,300,40);
cp.add(table1);
cp.add(months6);
cp.add(date1);
cp.add(tchl);
cp.add(tgl);
cp.add(hdl);
cp.add(ldl);
cp.add(vldl);
cp.add(date2);
cp.add(mau);
cp.add(remarks);
cp.add(lipidsand);
cp.add(mau1);





//12 months
months12=new JLabel("12 Months-Report");
months12.setBounds(40,290,140,30);


cxr=new JLabel("CXR",JLabel.RIGHT);

cxr.setBounds(10,350,140,30);
jt1=new JTextArea(100,380);
jt1.setBounds(150,350,400,70);

ecg=new JLabel("ECG",JLabel.RIGHT);
ecg.setBounds(10,450,140,30);
jt2=new JTextArea(100,380);
jt2.setBounds(150,450,400,70);


fundus=new JLabel("Fundus",JLabel.RIGHT);
fundus.setBounds(10,550,140,30);
jt3=new JTextArea(100,380);
jt3.setBounds(150,550,400,70);

cp.add(months12);
cp.add(cxr);
cp.add(jt1);
cp.add(ecg);
cp.add(jt2);
cp.add(fundus);
cp.add(jt3);
//rtf Report
final Object colheads2[]={"RFT","SC","BU","BUN","LFT","TBIL","SGOT","SGPT" ,"ALKP","DATE","HB"};
Object rowdata2[][]={{"","","","","","","","","","",""},{"","","","", "","","","","","",""}};
table2=new JTable(rowdata2,colheads2);
table2.setBounds(30,700,500,30);
rft=new JLabel("R.F.T");
rft.setBounds(35,680,500,30);
cp.add(rft);
sc=new JLabel("SC");
sc.setBounds(90,680,500,30);
cp.add(sc);
bu=new JLabel("BU");
bu.setBounds(135,680,500,30);
cp.add(bu);
bun=new JLabel("BUN");
bun.setBounds(175,680,500,30);
cp.add(bun);



lft=new JLabel("L.F.T");
lft.setBounds(225,680,500,30);
cp.add(lft);


tbil=new JLabel("T.BIL");
tbil.setBounds(270,680,500,30);
cp.add(tbil);

sgot=new JLabel("SGOT");
sgot.setBounds(312,680,500,30);
cp.add(sgot);

sgpt=new JLabel("SGPT");
sgpt.setBounds(357,680,500,30);
cp.add(sgpt);

alkp=new JLabel("ALK.P");
alkp.setBounds(405,680,500,30);
cp.add(alkp);

date2=new JLabel("Date");
date2.setBounds(452,680,500,30);
cp.add(date2);
hb=new JLabel("Hb");
hb.setBounds(503,680,500,30);
cp.add(hb);





cp.add(table2);

addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent we)
{
dispose();
//System.exit(0);
}
});
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==jb1)
{
//cp.setBackground(Color.red);
try
{

//PrinterJob printJob =PrinterJob.getPrinterJob();
//printJob.setPrintable(this);
Toolkit toolkit = this.getToolkit();
PrintJob printJob1 = toolkit.getPrintJob(this, "", null);
Graphics g = printJob1.getGraphics();
this.print(g);
printJob1.end();

/*if (printJob1.printDialog())
try {
printJob.print();
} catch(PrinterException pe) {
System.out.println("Error printing: " + pe);
}*/
// proj1 o=new proj1();
// dispose();
// o.start();
// o.pack();
// o.setSize(1600,1600);
// o.show();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
public static void main(String args[])throws Exception
{
sd7 o=new sd7();
o.setSize(900,900);
o.show();
}
}
Nov 28 '10 #2

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

Similar topics

2
by: Terry | last post by:
Any .dll or COM+ for .Net can help me retrive data from a Access file? The table contain several columns and the last one is a container which I store Article; because each article is a little bit...
8
by: dbaplusplus | last post by:
I worked on web development using java script many many years, so I am now a newbie to javascript. I have a single html page, which is generated dynamically using some programming language. Web...
0
by: avishekb | last post by:
can anyone suggest me how to retrive data from a xml file using c/c++. for example: <schema> <applt to>portno</applyto> <type>int</type> <value>8080</value> </schema> i want to retrive the...
3
by: =?Utf-8?B?UGV0ZXIgSiwgU2Nhbmlh?= | last post by:
Hello I'm looking for an solution about how to retrive data from an client side located Excel document by using an ASP.Net application. I don't want to upload the file to the server. I just want...
23
nehashri
by: nehashri | last post by:
hi i am designing a database using Ms Access and ASP. i have 3 tables in access namely 'PERSONAL', other as 'POLICY' and 3rd one is named as 'STAFF'. in the contact table i have ID, Name, Children...
1
by: manju1983 | last post by:
hello hi everyone, i am doing project using java swings now i have created a Jframe .that jframe contains 3 text fields and 2 jbuttons. now the problem is , when i press the submit button ,...
3
by: nico3334 | last post by:
I'm filling in a Report with SQL data using VB code. I'm using LOOP and MoveNext. Before using MoveNext, I would like to be able to check whether the new data is equal to the previous data that was...
2
by: mannavavp | last post by:
hi friends, please let me know how i can store audio files in database table using java programming?
1
by: swatiawasthy | last post by:
hi i am developing a gui in java swings and i am getting my database displayed in jtable... i have a textfield labeled CUSTID and my table also has its sec column as CUSTID (which is not a primary...
11
by: gaya3 | last post by:
Hi All, I am very much new to java Swings I need to open the PDF file from Swings application.. I tried as follows... Runtime r= Runtime.getRuntime(); Process p = r.exec("C:/Program...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: 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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.