0% found this document useful (0 votes)
3 views

idcard

The document contains Java code for an ID Card Generator System using Swing for the GUI. It includes a panel with various input fields such as student name, department selection, enrollment number, address, date of birth, and mobile number, along with buttons for generating the ID card and attaching a photo. The main class creates a JFrame that holds the panel within a tabbed pane.

Uploaded by

Payal Amup
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

idcard

The document contains Java code for an ID Card Generator System using Swing for the GUI. It includes a panel with various input fields such as student name, department selection, enrollment number, address, date of birth, and mobile number, along with buttons for generating the ID card and attaching a photo. The main class creates a JFrame that holds the panel within a tabbed pane.

Uploaded by

Payal Amup
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

import java.awt.

*;
import javax.swing.*;
import java.awt.event.*;
class Panel1 extends Panel implements ActionListener{
JLabel l1,l2,l3,l4,l5,l6,l7,l8;
JTextArea ta;
JTextField t1,t2;
JComboBox c1;
JRadioButton r1,r2,r3,r4;
JButton b ,b1;

Panel1()
{
setLayout(null);
Font f=new Font("Times new roman",Font.BOLD|Font.ITALIC,20);
l1=new JLabel("ID Card Generator System");
l1.setFont(f);
l1.setBounds(100,100,300,20);
l8=new JLabel("Add photo");
l8.setBounds(100,200,150,20);
l2=new JLabel("Enter Student name :");
l2.setBounds(100,250,150,20);
l3=new JLabel("Select Department");
l3.setBounds(100,300,150,20);
l4=new JLabel("Select Enrollment no.");
l4.setBounds(100,350,150,20);
l5=new JLabel("Enter Address");
l5.setBounds(100,400,150,20);
l6=new JLabel("Enter date of birth");
l6.setBounds(100,450,150,20);
l7=new JLabel("Enter mobile no");
l7.setBounds(100,500,150,20);

b1=new JButton("Attach photo");


b1.setBounds(300,200,150,20);

ta=new JTextArea(40,20);
ta.setBounds(300,400,150,50);

t1=new JTextField(50);
t1.setBounds(300,250,150,20);

t2=new JTextField(10);
t2.setBounds(300,500,150,20);

b=new JButton("Generate ID Card");


b.setBounds(200,600,150,50);

r1=new JRadioButton("CO");
r1.setBounds(300,300,50,20);

r2=new JRadioButton("CE");
r2.setBounds(350,300,50,20);

r3=new JRadioButton("ENTC");
r3.setBounds(400,300,70,20);

r4=new JRadioButton("ME");
r4.setBounds(470,300,50,20);

c1=new JComboBox();
c1.addItem("2005080001");
c1.addItem("2005080002");
c1.addItem("2005080003");
c1.addItem("2005080004");
c1.addItem("2005080005");
c1.addItem("2005080006");
c1.addItem("2005080007");
c1.addItem("2005080008");
c1.addItem("2005080009");
c1.addItem("2005080010");
c1.setBounds(300,350,150,20);

add(l1);
add(l2);
add(l3);
add(l4);
add(l5);
add(l6);
add(l7);
add(l8);
add(b);
add(b1);
add(t1);
add(t2);
add(ta);
add(c1);
add(r1);
add(r2);
add(r3);
add(r4);

b1.addActionListener(this);
}
public void actionPerformed(ActionEvent e) {
if(e.getSource()==b1) {
FileDialog f= new FileDialog (this,"select
photo",FileDialog.LOAD); //error
f.setVisible(true);
}
}

public class IDCard extends JFrame {


IDCard(){
Container c =getContentPane();
Panel1 p1=new Panel1();
JTabbedPane jtp=new JTabbedPane();
jtp.add("Tab1" ,p1);
c.add(jtp);
}

public static void main(String[] args) {


IDCard id=new IDCard();
id.setVisible(true);
id.setSize(1000,1000);
}

You might also like