package idcardgeneratingsystem;
//import these libraries
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class Home extends [Link] {
/**
* Creates new form Home
*/
private ImageIcon format=null;
String fname=null;
int s=0;
byte[] pimage=null;
int lvalue = 1000;
public Home() {
initComponents();
}
private void jButton1ActionPerformed([Link] evt) {
// these codes use for select image from local machine
JFileChooser fchoser=new JFileChooser();
[Link](null);
File f=[Link]();
fname=[Link]();
ImageIcon micon=new ImageIcon(fname);
try {
File image=new File(fname);
FileInputStream fis=new FileInputStream(image);
ByteArrayOutputStream baos=new ByteArrayOutputStream();
byte[] buf=new byte[1024];
for(int readnum; (readnum=[Link](buf)) !=-1;)
{
[Link](buf,0,readnum);
}
pimage=[Link]();
[Link](resizeImage(fname, buf));
} catch (Exception e) {
}
}
private void jButton2ActionPerformed([Link] evt) {
// Thse codes use for set details on printing panel
String cou=[Link]();
String date=((JTextField)[Link]().getUiComponent()).getText();
String
birthday=((JTextField)[Link]().getUiComponent()).getText();
String name= [Link]();
String adress= [Link]();
String gender = [Link]().toString();
String info = [Link]();
[Link](cou);
[Link](date);
[Link](cou);
[Link](name);
[Link](birthday);
[Link](adress);
[Link](gender);
[Link](info);
//id number generate
String year= [Link](2, 4);
// [Link](rootPane, year);
int genvalue=0;
if([Link]("Male")) //
{
genvalue=100;
}
else{
genvalue=500;
}
lvalue++;
String gen = [Link](genvalue);
String las = [Link](lvalue);
String nic= year+gen+las+"V";
[Link](nic);
private void jButton3ActionPerformed([Link] evt) {
// these codes use to print panel
try {
Toolkit tkp = [Link]();
PrintJob pjp = [Link](this, null, null);
Graphics g = [Link]();
[Link](g);
[Link]();
[Link]();
} catch (Exception e) {
}
}
This method use to resize image to fit lable
public ImageIcon resizeImage(String imagePath, byte[] pic){
ImageIcon myImage=null;
if(imagePath !=null)
{
myImage=new ImageIcon(imagePath);
}else{
myImage=new ImageIcon(pic);
}
Image img=[Link]();
Image img2=[Link]([Link](), [Link](),
Image.SCALE_SMOOTH);
ImageIcon image=new ImageIcon(img2);
return image;