Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified FormFrameFile.class
Binary file not shown.
261 changes: 246 additions & 15 deletions FormFrameFile.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,174 @@
package Projekt;

import java.io.*;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;

class FormFrame extends Frame implements ActionListener {
class FormDeleteFrame extends Frame implements ActionListener{ //form-delete frame

String str;

Label deleteL, deleteOutL;
Button deleteB;
TextField deleteFileTf, deleteOutTf;
FormDeleteFrame(String s) {
super(s);
setLayout(null);
setSize(925,1050); //width - height
setFont(new Font("Helvetica",Font.BOLD,40));
setBackground(Color.black);
setForeground(Color.white);

//delete label
deleteL = new Label("★ Enter ID To Delete Form:-");
deleteL.setBounds(100, 220, 550, 50);

deleteFileTf = new TextField();
deleteFileTf.setForeground(Color.black);
deleteFileTf.setBounds(100, 300, 650, 60);

//delete button
deleteB = new Button("DELETE");
deleteB.setForeground(Color.black);
deleteB.setBounds(100, 400, 300, 50);

//deleted successfully
deleteOutL = new Label("★ Form Status:-");
deleteOutL.setBounds(100, 570, 550, 50);
deleteOutTf = new TextField();
deleteOutTf.setBackground(Color.black);
deleteOutTf.setEditable(false);
//here color of status
deleteOutTf.setBounds(100, 650, 650, 60);

add(deleteL);
add(deleteFileTf);

add(deleteB);

add(deleteOutL);
add(deleteOutTf);

deleteB.addActionListener(this);

//close
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}

@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(e.getSource() == deleteB) {

str = deleteFileTf.getText();

File f = new File("D:\\Java Programs\\Java Eclipse\\EclipsePrograms\\IO files\\"+str+".txt");

if(f.exists() == true) {
f.delete();
deleteOutTf.setBackground(Color.black);
deleteOutTf.setForeground(Color.GREEN);
deleteOutTf.setText("Form Deleted");
}
else if(f.exists() == false) {
deleteOutTf.setBackground(Color.black);
deleteOutTf.setForeground(Color.red);
deleteOutTf.setText("File Does Not Exist");
}

}
}
}



class FormSearchFrame extends Frame implements ActionListener{ //form-search frame

//file-->
File fSearch;

//frame
TextField searchTf, searchOutTf;
Label searchL, searchOutL;
Button searchB;

FormSearchFrame(String s){
super(s);
setLayout(null);
setSize(925,1050); //width - height
setFont(new Font("Helvetica",Font.BOLD,40));
setBackground(Color.black);
setForeground(Color.white);
//search
searchL = new Label("★ Search Form By ID:-");
searchL.setBounds(100, 220, 550, 50);

searchTf = new TextField();
searchTf.setForeground(Color.black);
searchTf.setBounds(100, 300, 650, 60);

//search btn
searchB = new Button("SEARCH");
searchB.setForeground(Color.black);
searchB.setBounds(100, 400, 300, 50);

//searchOutL
searchOutL = new Label("★ Form Status:-");
searchOutL.setBounds(100, 570, 550, 50);
searchOutTf = new TextField();
searchOutTf.setBackground(Color.black);
searchOutTf.setEditable(false);
//here color of status
searchOutTf.setBounds(100, 650, 650, 60);

add(searchL);
add(searchTf);
add(searchB);

add(searchOutL);
add(searchOutTf);


searchB.addActionListener(this);

//close
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
@Override
public void actionPerformed(ActionEvent e) {
String str;
str = searchTf.getText();
fSearch = new File("D:\\Java Programs\\Java Eclipse\\EclipsePrograms\\IO files\\"+str+".txt");
//************************************status color
if(fSearch.exists() == true) {
searchOutTf.setBackground(Color.black);
searchOutTf.setForeground(Color.GREEN);
}
else {
searchOutTf.setBackground(Color.black);
searchOutTf.setForeground(Color.red);
}
//**************************************status color-end
if(e.getSource() == searchB) {
if(fSearch.exists() == true) {
searchOutTf.setText("File Available");
}
else if(fSearch.exists() == false) {
searchOutTf.setText("File Unavailable");
}
}
}
}
class FormFrame extends Frame implements ActionListener { //form fill frame
//File-->
File f;
FileOutputStream fos;
Expand All @@ -14,13 +178,13 @@ class FormFrame extends Frame implements ActionListener {
Button submitB;
Choice deptCh, admYrCh, secCh, genderCh;
Label hL,emailL, selectDeptL, fullNameL, admYrL, secL, rollL, genderL, mobileL, permanentL;
TextField emailTf, fullNameTf, rollTf, mobileTf, permanentTf;
TextField emailTf, fullNameTf, rollTf, mobileTf, permanentTf, savedSuccessTf;
FormFrame(String s) throws Exception {

super(s);
setLayout(null);
setSize(925,1050); //width,height

//headline
hL = new Label("Provisional Admission Form");
hL.setFont(new Font("Helvetica",Font.BOLD,50));
Expand Down Expand Up @@ -109,7 +273,10 @@ class FormFrame extends Frame implements ActionListener {
submitB.setBounds(360, 850, 200, 60);
//TODO: complete form --> design it --> file handling --> done


//saved-successTf
savedSuccessTf = new TextField(" ★ All Fields Mandatory");
savedSuccessTf.setEditable(false);
savedSuccessTf.setBounds(335, 950, 250, 35);

//
add(hL);
Expand Down Expand Up @@ -143,12 +310,23 @@ class FormFrame extends Frame implements ActionListener {

add(submitB);//

add(savedSuccessTf);

submitB.addActionListener(this);

//********************************************************************************************************close
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
@Override
public void actionPerformed(ActionEvent e) {
String sureRoll;
sureRoll = rollTf.getText();

f = new File("D:\\Java Programs\\Java Eclipse\\EclipsePrograms\\IO files\\"+rollTf.getText()+".txt");
f = new File("D:\\Java Programs\\Java Eclipse\\EclipsePrograms\\IO files\\"+sureRoll+".txt");
try {
fos = new FileOutputStream(f, false);
} catch (FileNotFoundException e2) {
Expand All @@ -157,6 +335,7 @@ public void actionPerformed(ActionEvent e) {
}
// TODO Auto-generated method stub
if(e.getSource() == submitB) {

//email Label
str = emailL.getText();
ch = str.toCharArray();
Expand Down Expand Up @@ -418,28 +597,49 @@ public void actionPerformed(ActionEvent e) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
//saved success
savedSuccessTf.setText(" ★ Successfully Saved");

}//end if(getSource() == submit)m
}
}
//Applet
public class FormFrameFile extends Applet implements ActionListener {
//Applet---------------->
public class FormFrameFile extends Applet implements ActionListener { //applet

//frame
FormFrame ff;
FormFrame ff;
FormSearchFrame fsf;
FormDeleteFrame fdf;

TextArea ta;
Label l1, l2;
Button FormBtn;
Button FormBtn, SearchBtn, DeleteBtn, UpdateBtn;
public void init() {

setLayout(null);
setSize(1850, 1050);
setBackground(Color.black);

try {
ff = new FormFrame("Admission Form"); //fill form cons
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
fsf = new FormSearchFrame("Form: Search Form"); //search form cons
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
ff = new FormFrame("Admission Form");
fdf = new FormDeleteFrame("Form: Delete Form"); //delete form cons
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

//Applet contents----------------------------------->
l1 = new Label("Prof. Ram Meghe Institute of Technology & Research");
l1.setFont(new Font("Helvetica",Font.BOLD,50));
l1.setForeground(Color.white);
Expand All @@ -448,31 +648,62 @@ public void init() {
l2 = new Label("Provisional Admission Form (Only for Regular Students)");
l2.setFont(new Font("Helvetica",Font.BOLD,40));
l2.setForeground(Color.red);
l2.setBounds(430, 200, 1100, 80);
l2.setBounds(430, 150, 1100, 80);

ta = new TextArea("\n The students who have filled and submitted\n the Summer 2020 SGBAU Examination form\n are only eligible to fill the Provisional\n Admission Form for the Admission to the\n Higher Class.\n\n Note:- Your details will get stored in a file\n (File Name is your Roll No.)",8,40,TextArea.SCROLLBARS_NONE);
ta.setFont(new Font("Helvetica",Font.BOLD,25));
ta.setBackground(Color.black);
ta.setForeground(Color.white);
ta.setEditable(false);
ta.setBounds(660, 400, 560, 300);
ta.setBounds(660, 300, 560, 300);

//button-form applet
FormBtn = new Button("Fill Form");
FormBtn.setFont(new Font("Helvetica",Font.BOLD,30));
FormBtn.setBounds(850, 800, 200, 40);
FormBtn.setBounds(660, 700, 200, 40);

//button-search
SearchBtn = new Button("Search Form");
SearchBtn.setFont(new Font("Helvetica",Font.BOLD,30));
SearchBtn.setBounds(1020, 700, 200, 40);

//button-delete
DeleteBtn = new Button("Delete Form");
DeleteBtn.setFont(new Font("Helvetica",Font.BOLD,30));
DeleteBtn.setBounds(660, 800, 200, 40);

//button-update
UpdateBtn = new Button("Update Form");
UpdateBtn.setFont(new Font("Helvetica",Font.BOLD,30));
UpdateBtn.setBounds(1020, 800, 200, 40);


add(l1);
add(l2);
add(ta);
add(FormBtn);

add(FormBtn);
add(SearchBtn);
add(DeleteBtn);
add(UpdateBtn);

//registration
FormBtn.addActionListener(this);
SearchBtn.addActionListener(this);
DeleteBtn.addActionListener(this);
UpdateBtn.addActionListener(this);
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(e.getSource() == FormBtn) {
ff.setVisible(true);
ff.setVisible(true); //form fill
}
else if(e.getSource() == SearchBtn) {
fsf.setVisible(true); //form search
}
else if(e.getSource() == DeleteBtn) {
fdf.setVisible(true); //form delete
}
}
}