import java.util.*;
import java.awt.*;
import javax.swing.*;
import javax.swing.eve nt.*;
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,da te=null,ghba1c= null,per=null;
JButton jb1=null;
//6 month table details
JTable table1=null;
JLabel months6=null,da te1=null,tgl=nu ll,ldl=null,tch l=null,hdl=null ,vldl=null,date 2=null,mau=null ,remarks=null;
JLabel lipidsand=null, mau1=null;
//12months
JLabel cxr=null,ecg=nu ll,fundus=null, months12=null;
JTextArea jt1=null,jt2=nu ll,jt3=null;
//RFT details
JTable table2=null;
JLabel rft=null,sc=nul l,bu=null,bun=n ull,lft=null,tb il=null,sgot=nu ll,sgpt=null,al kp=null,date3=n ull,hb=null;
public sd7()throws Exception
{
cp=getContentPa ne();
cp.setLayout(nu ll);
cp.setBackgroun d(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.setBoun ds(40,10,300,40 );
date.setBounds( 190,20,300,40);
ghba1c.setBound s(400,20,300,40 );
per.setBounds(4 70,20,300,40);
table.setBounds (100,50,460,80) ;
jb1=new JButton("submit ");
jb1.setBounds(7 90,400,100,40);
int h=ScrollPaneCon stants.HORIZONT AL_SCROLLBAR_AS _NEEDED;
int v=ScrollPaneCon stants.VERTICAL _SCROLLBAR_AS_N EEDED;
jb1.addActionLi stener(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","L DL","VLDL","DAT E","MAU","REMAR KS"};
Object rowdata1[][]={{"","","","", "","","","",""} ,{"","","",""," ","","","",""}, {"","","","","" ,"","","",""},{ "","","","","", "","","",""},{" ","","","",""," ","","",""} };
table1=new JTable(rowdata1 ,colheads1);
int h1=ScrollPaneCo nstants.HORIZON TAL_SCROLLBAR_A S_NEEDED;
int v1=ScrollPaneCo nstants.VERTICA L_SCROLLBAR_AS_ NEEDED;
table1.setBound s(65,200,500,80 );
months6.setBoun ds(40,145,300,4 0);
date1.setBounds (80,170,300,40) ;
tchl.setBounds( 140,170,300,40) ;
tgl.setBounds(2 00,170,300,40);
hdl.setBounds(2 50,170,300,40);
ldl.setBounds(3 07,170,300,40);
vldl.setBounds( 350,170,300,40) ;
date2.setBounds (410,170,300,40 );
mau.setBounds(4 70,170,300,40);
remarks.setBoun ds(512,170,300, 40);
lipidsand.setBo unds(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(lipidsan d);
cp.add(mau1);
//12 months
months12=new JLabel("12 Months-Report");
months12.setBou nds(40,290,140, 30);
cxr=new JLabel("CXR",JL abel.RIGHT);
cxr.setBounds(1 0,350,140,30);
jt1=new JTextArea(100,3 80);
jt1.setBounds(1 50,350,400,70);
ecg=new JLabel("ECG",JL abel.RIGHT);
ecg.setBounds(1 0,450,140,30);
jt2=new JTextArea(100,3 80);
jt2.setBounds(1 50,450,400,70);
fundus=new JLabel("Fundus" ,JLabel.RIGHT);
fundus.setBound s(10,550,140,30 );
jt3=new JTextArea(100,3 80);
jt3.setBounds(1 50,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","B U","BUN","LFT", "TBIL","SGOT"," SGPT","ALKP","D ATE","HB"};
Object rowdata2[][]={{"","","","", "","","","","", "",""},{"",""," ","","","",""," ","","",""} };
table2=new JTable(rowdata2 ,colheads2);
table2.setBound s(30,700,500,30 );
rft=new JLabel("R.F.T") ;
rft.setBounds(3 5,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(13 5,680,500,30);
cp.add(bu);
bun=new JLabel("BUN");
bun.setBounds(1 75,680,500,30);
cp.add(bun);
lft=new JLabel("L.F.T") ;
lft.setBounds(2 25,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(50 3,680,500,30);
cp.add(hb);
cp.add(table2);
addWindowListen er(new WindowAdapter()
{
public void windowClosing(W indowEvent we)
{
dispose();
//System.exit(0);
}
});
}
public void actionPerformed (ActionEvent ae)
{
if(ae.getSource ()==jb1)
{
//cp.setBackgroun d(Color.red);
try
{
//PrinterJob printJob =PrinterJob.get PrinterJob();
//printJob.setPri ntable(this);
Toolkit toolkit = this.getToolkit ();
PrintJob printJob1 = toolkit.getPrin tJob(this, "", null);
Graphics g = printJob1.getGr aphics();
this.print(g);
printJob1.end() ;
/*if (printJob1.prin tDialog())
try {
printJob.print( );
} catch(PrinterEx ception pe) {
System.out.prin tln("Error printing: " + pe);
}*/
// proj1 o=new proj1();
// dispose();
// o.start();
// o.pack();
// o.setSize(1600, 1600);
// o.show();
}
catch(Exception e)
{
e.printStackTra ce();
}
}
}
public static void main(String args[])throws Exception
{
sd7 o=new sd7();
o.setSize(900,9 00);
o.show();
}
}
import java.awt.*;
import javax.swing.*;
import javax.swing.eve nt.*;
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,da te=null,ghba1c= null,per=null;
JButton jb1=null;
//6 month table details
JTable table1=null;
JLabel months6=null,da te1=null,tgl=nu ll,ldl=null,tch l=null,hdl=null ,vldl=null,date 2=null,mau=null ,remarks=null;
JLabel lipidsand=null, mau1=null;
//12months
JLabel cxr=null,ecg=nu ll,fundus=null, months12=null;
JTextArea jt1=null,jt2=nu ll,jt3=null;
//RFT details
JTable table2=null;
JLabel rft=null,sc=nul l,bu=null,bun=n ull,lft=null,tb il=null,sgot=nu ll,sgpt=null,al kp=null,date3=n ull,hb=null;
public sd7()throws Exception
{
cp=getContentPa ne();
cp.setLayout(nu ll);
cp.setBackgroun d(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.setBoun ds(40,10,300,40 );
date.setBounds( 190,20,300,40);
ghba1c.setBound s(400,20,300,40 );
per.setBounds(4 70,20,300,40);
table.setBounds (100,50,460,80) ;
jb1=new JButton("submit ");
jb1.setBounds(7 90,400,100,40);
int h=ScrollPaneCon stants.HORIZONT AL_SCROLLBAR_AS _NEEDED;
int v=ScrollPaneCon stants.VERTICAL _SCROLLBAR_AS_N EEDED;
jb1.addActionLi stener(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","L DL","VLDL","DAT E","MAU","REMAR KS"};
Object rowdata1[][]={{"","","","", "","","","",""} ,{"","","",""," ","","","",""}, {"","","","","" ,"","","",""},{ "","","","","", "","","",""},{" ","","","",""," ","","",""} };
table1=new JTable(rowdata1 ,colheads1);
int h1=ScrollPaneCo nstants.HORIZON TAL_SCROLLBAR_A S_NEEDED;
int v1=ScrollPaneCo nstants.VERTICA L_SCROLLBAR_AS_ NEEDED;
table1.setBound s(65,200,500,80 );
months6.setBoun ds(40,145,300,4 0);
date1.setBounds (80,170,300,40) ;
tchl.setBounds( 140,170,300,40) ;
tgl.setBounds(2 00,170,300,40);
hdl.setBounds(2 50,170,300,40);
ldl.setBounds(3 07,170,300,40);
vldl.setBounds( 350,170,300,40) ;
date2.setBounds (410,170,300,40 );
mau.setBounds(4 70,170,300,40);
remarks.setBoun ds(512,170,300, 40);
lipidsand.setBo unds(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(lipidsan d);
cp.add(mau1);
//12 months
months12=new JLabel("12 Months-Report");
months12.setBou nds(40,290,140, 30);
cxr=new JLabel("CXR",JL abel.RIGHT);
cxr.setBounds(1 0,350,140,30);
jt1=new JTextArea(100,3 80);
jt1.setBounds(1 50,350,400,70);
ecg=new JLabel("ECG",JL abel.RIGHT);
ecg.setBounds(1 0,450,140,30);
jt2=new JTextArea(100,3 80);
jt2.setBounds(1 50,450,400,70);
fundus=new JLabel("Fundus" ,JLabel.RIGHT);
fundus.setBound s(10,550,140,30 );
jt3=new JTextArea(100,3 80);
jt3.setBounds(1 50,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","B U","BUN","LFT", "TBIL","SGOT"," SGPT","ALKP","D ATE","HB"};
Object rowdata2[][]={{"","","","", "","","","","", "",""},{"",""," ","","","",""," ","","",""} };
table2=new JTable(rowdata2 ,colheads2);
table2.setBound s(30,700,500,30 );
rft=new JLabel("R.F.T") ;
rft.setBounds(3 5,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(13 5,680,500,30);
cp.add(bu);
bun=new JLabel("BUN");
bun.setBounds(1 75,680,500,30);
cp.add(bun);
lft=new JLabel("L.F.T") ;
lft.setBounds(2 25,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(50 3,680,500,30);
cp.add(hb);
cp.add(table2);
addWindowListen er(new WindowAdapter()
{
public void windowClosing(W indowEvent we)
{
dispose();
//System.exit(0);
}
});
}
public void actionPerformed (ActionEvent ae)
{
if(ae.getSource ()==jb1)
{
//cp.setBackgroun d(Color.red);
try
{
//PrinterJob printJob =PrinterJob.get PrinterJob();
//printJob.setPri ntable(this);
Toolkit toolkit = this.getToolkit ();
PrintJob printJob1 = toolkit.getPrin tJob(this, "", null);
Graphics g = printJob1.getGr aphics();
this.print(g);
printJob1.end() ;
/*if (printJob1.prin tDialog())
try {
printJob.print( );
} catch(PrinterEx ception pe) {
System.out.prin tln("Error printing: " + pe);
}*/
// proj1 o=new proj1();
// dispose();
// o.start();
// o.pack();
// o.setSize(1600, 1600);
// o.show();
}
catch(Exception e)
{
e.printStackTra ce();
}
}
}
public static void main(String args[])throws Exception
{
sd7 o=new sd7();
o.setSize(900,9 00);
o.show();
}
}
Comment