A Child Care Center management system, developed by Java, Java Swing and NetBeans RCP platform.
Applied typical Object-Oriented Programming
design concepts and full stack approach.
The project was made by 3 parts:
- Java Swing front end
- Back end logic
- Database
I used CSV for data storage to simplify the process
UI components:
- jPanel
- jTextfield
- jButton
- jTable
- jLabel
- etc.
Add data to jTable and basic settings of jFrame
DataHandler dataHandler = new DataHandler();
dataHandler.loadData();
children = dataHandler.children;
for (Child c : children) {
t.addRow(c.getInfo());
}
JTableHeader jtb = studentsTable.getTableHeader();
jtb.setFont(new Font("Helvetica", Font.BOLD, 20));
this.setResizable(false);
this.setVisible(true);
Load the selected data to side bars for edit or delete by adding click listener to jTable
private void studentsTableMouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
int i = studentsTable.getSelectedRow();
selectedRowIndex = i;
TableModel selectedModel = studentsTable.getModel();
selectedTableModel = selectedModel;
studentIdTextField.setText(selectedModel.getValueAt(i,0).toString());
nameTextField.setText(selectedModel.getValueAt(i,1).toString());
ageTextField.setText(selectedModel.getValueAt(i,2).toString());
}
Button click perform function
private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
selectedTableModel.setValueAt(studentIdTextField.getText(),selectedRowIndex,0);
selectedTableModel.setValueAt(nameTextField.getText(),selectedRowIndex,1);
selectedTableModel.setValueAt(ageTextField.getText(),selectedRowIndex,2);
studentIdTextField.setText("");
ageTextField.setText("");
nameTextField.setText("");
classTextField.setText("");
}
Object Oriented Programming Structure
Object Oriented Design Concepts:
- Abstraction
- Encapsulation
- Inheritance
- Polymorphism
File I/O
@Override
public List<Student> getDataFromCSV() {
List<Student> students = null;
try {
students = FileUtil.readFile(Student.class, "StudentData.csv");
} catch (Exception e) {
e.printStackTrace();
}
return students;
}
Singleton Factory Design Pattern
public class StudentDataFactory extends AbstractDataFactory {
private static StudentDataFactory factoryInstance = null;
private static StudentDataHandler studentDataHandler = null;
private StudentDataFactory() {
}
public static AbstractDataFactory getFactoryInstance() {
if (factoryInstance == null) {
factoryInstance = new StudentDataFactory();
}
return factoryInstance;
}
@Override
public DataHandler getObject() {
if (studentDataHandler == null)
studentDataHandler = new StudentDataHandler();
return studentDataHandler;
}
}