Sunteți pe pagina 1din 12

import java.util.

Date;

public class fees extends javax.swing.JFrame {

public FeesReceipt() {

initComponents();

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

jButton2 = new javax.swing.JButton();

jButton3 = new javax.swing.JButton();

jButton5 = new javax.swing.JButton();

lTitle = new javax.swing.JLabel();

lFatherName = new javax.swing.JLabel();

lStudentName = new javax.swing.JLabel();

lBatchTiming = new javax.swing.JLabel();

lFatherMoblie = new javax.swing.JLabel();

lFeesAmount = new javax.swing.JLabel();

tStudentName = new javax.swing.JTextField();

tFatherName = new javax.swing.JTextField();

tBatchTiming = new javax.swing.JTextField();

tFatherMobile = new javax.swing.JTextField();

tFeesAmount = new javax.swing.JTextField();

jGR = new javax.swing.JButton();

jR = new javax.swing.JButton();

jPR = new javax.swing.JButton();

jScrollPane1 = new javax.swing.JScrollPane();

Area = new javax.swing.JTextArea();


jButton2.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N

jButton2.setText("Generate Receipt");

jButton3.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N

jButton3.setText("Generate Receipt");

jButton5.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N

jButton5.setText("Generate Receipt");

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

lTitle.setFont(new java.awt.Font("Times New Roman", 1, 36)); // NOI18N

lTitle.setText("Fees Receipt System");

lFatherName.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N

lFatherName.setText("Enter Father Name: ");

lStudentName.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N

lStudentName.setText("Enter Student Name: ");

lBatchTiming.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N

lBatchTiming.setText("Enter Batch Timing: ");

lFatherMoblie.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N

lFatherMoblie.setText("Enter Father Mobile:");

lFeesAmount.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N

lFeesAmount.setText("Enter Fees Amount:");

tStudentName.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N

tFatherName.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N

tBatchTiming.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N

tFatherMobile.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N

tFeesAmount.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N

jGR.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N

jGR.setText("Generate Receipt");

jGR.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jGRActionPerformed(evt);
}

});

jR.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N

jR.setText("Reset");

jR.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jRActionPerformed(evt);

});

jPR.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N

jPR.setText("Print Receipt");

jPR.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jPRActionPerformed(evt);

});

Area.setEditable(false);

Area.setColumns(20);

Area.setRows(5);

jScrollPane1.setViewportView(Area);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addContainerGap(19, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
false)

.addGroup(javax.swing.GroupLayout.Alignment.LEADING,
layout.createSequentialGroup()

.addComponent(lStudentName)

.addGap(62, 62, 62)

.addComponent(tStudentName, javax.swing.GroupLayout.PREFERRED_SIZE, 165,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(javax.swing.GroupLayout.Alignment.LEADING,
layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addComponent(lFeesAmount, javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(lFatherMoblie, javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(lBatchTiming, javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(lFatherName, javax.swing.GroupLayout.Alignment.LEADING))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(tFatherName, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(tBatchTiming, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(tFatherMobile, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(tFeesAmount, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE)))

.addGroup(javax.swing.GroupLayout.Alignment.LEADING,
layout.createSequentialGroup()

.addComponent(jGR)

.addGap(35, 35, 35)

.addComponent(jR)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPR)))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 31,
Short.MAX_VALUE))

.addGroup(layout.createSequentialGroup()

.addGap(91, 91, 91)

.addComponent(lTitle)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))

.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 280,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(25, 25, 25))

);

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addGroup(layout.createSequentialGroup()

.addContainerGap()

.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 322,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()

.addGap(41, 41, 41)

.addComponent(lTitle)

.addGap(27, 27, 27)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(lStudentName)

.addComponent(tStudentName, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lFatherName)

.addComponent(tFatherName, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(lBatchTiming)

.addComponent(tBatchTiming, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(lFatherMoblie)

.addComponent(tFatherMobile, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(lFeesAmount)

.addComponent(tFeesAmount, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(18, 18, 18)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jGR)

.addComponent(jR)

.addComponent(jPR))))

.addContainerGap(21, Short.MAX_VALUE))

);

pack();

}// </editor-fold>

private void jGRActionPerformed(java.awt.event.ActionEvent evt) {


Area.setText("***************************************************\n");

Area.setText(Area.getText()+"* FEES RECEIPT *\n");

Area.setText(Area.getText()+"***************************************************\n");

Date obj = new Date();

String date = obj.toString();

Area.setText(Area.getText()+"\n"+date+"\n\n");

Area.setText(Area.getText()+"Students Name: "+tStudentName.getText()+"\n\n");

Area.setText(Area.getText()+"Fathers Name:\t "+tFatherName.getText()+"\n\n");

Area.setText(Area.getText()+"Batch Timing:\t "+tBatchTiming.getText()+"\n\n");

Area.setText(Area.getText()+"Father Mobile:\t "+tFatherMobile.getText()+"\n\n");

Area.setText(Area.getText()+"Fees Amount:\t "+tFeesAmount.getText()+"\n\n Signature: \n");

private void jRActionPerformed(java.awt.event.ActionEvent evt) {

Area.setText("");

tStudentName.setText("");

tFatherName.setText("");

tBatchTiming.setText("");

tFatherMobile.setText("");

tFeesAmount.setText("");

private void jPRActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

try{
Area.print();

catch (Exception e){

public static void main(String args[]) {

try {

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(FeesReceipt.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(FeesReceipt.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(FeesReceipt.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {


java.util.logging.Logger.getLogger(FeesReceipt.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new FeesReceipt().setVisible(true);

});

// Variables declaration - do not modify

private javax.swing.JTextArea Area;

private javax.swing.JButton jButton2;

private javax.swing.JButton jButton3;

private javax.swing.JButton jButton5;

private javax.swing.JButton jGR;

private javax.swing.JButton jPR;

private javax.swing.JButton jR;

private javax.swing.JScrollPane jScrollPane1;

private javax.swing.JLabel lBatchTiming;

private javax.swing.JLabel lFatherMoblie;

private javax.swing.JLabel lFatherName;

private javax.swing.JLabel lFeesAmount;

private javax.swing.JLabel lStudentName;

private javax.swing.JLabel lTitle;

private javax.swing.JTextField tBatchTiming;

private javax.swing.JTextField tFatherMobile;

private javax.swing.JTextField tFatherName;


private javax.swing.JTextField tFeesAmount;

private javax.swing.JTextField tStudentName;

// End of variables declaration

}
Figure 1: GUI of the Fees Receipt Program (without data inserted)

Figure 2: Shows the Inputs in the program as well as the result after clicking the “Generate Receipt”
button.
Figure 3: After clicking the “Reset” button.

S-ar putea să vă placă și