├── .gitignore
├── README.md
├── build.xml
├── manifest.mf
├── nbproject
├── build-impl.xml
├── configs
│ ├── Run_as_WebStart.properties
│ └── Run_in_Browser.properties
├── genfiles.properties
├── jfx-impl.xml
├── project.properties
└── project.xml
└── src
├── database
└── school.sql
├── helpers
└── DbConnect.java
├── libaries_icons
├── fontawesomefx-8.9.jar
├── fontawesomefx-glyphsbrowser-all-1.0.jar
├── jfoenix-8.0.1.jar
└── mysql-connector-java-5.1.42-bin.jar
├── models
└── Student.java
├── operationtable
└── OperationTable.java
└── tableView
├── AddStudentController.java
├── TableViewController.java
├── addStudent.fxml
├── tableView.fxml
└── tableview.css
/.gitignore:
--------------------------------------------------------------------------------
1 | /build/
2 | /dist/
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # operation-of-table
2 | This project we show you how to insert & update & delete and save data in Database and load it to TableView using javaFx and MySQL
3 |
--------------------------------------------------------------------------------
/build.xml:
--------------------------------------------------------------------------------
1 |
2 | Builds, tests, and runs the project opration-of-table.
3 |
4 |
53 |
54 |
--------------------------------------------------------------------------------
/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/nbproject/build-impl.xml:
--------------------------------------------------------------------------------
1 |
2 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 | Must set src.dir
235 | Must set test.src.dir
236 | Must set build.dir
237 | Must set dist.dir
238 | Must set build.classes.dir
239 | Must set dist.javadoc.dir
240 | Must set build.test.classes.dir
241 | Must set build.test.results.dir
242 | Must set build.classes.excludes
243 | Must set dist.jar
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 | Must set javac.includes
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 | No tests executed.
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
514 |
515 |
516 |
517 |
518 |
519 |
520 |
521 |
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 |
596 |
597 |
598 |
599 |
600 |
601 |
602 |
603 |
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 |
613 |
614 |
615 |
616 |
617 |
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 |
626 |
627 |
628 |
629 |
630 |
631 |
632 |
633 |
634 |
635 |
636 |
637 |
638 |
639 |
640 |
641 |
642 |
643 |
644 |
645 |
646 |
647 |
648 |
649 |
650 |
651 |
652 |
653 |
654 |
655 |
656 |
657 |
658 |
659 |
660 |
661 |
662 |
663 |
664 |
665 |
666 |
667 |
668 |
669 |
670 |
671 |
672 |
673 |
674 |
675 |
676 |
677 |
678 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 |
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 |
700 |
701 |
702 |
703 |
704 |
705 |
706 |
707 |
708 |
709 |
710 |
711 |
712 |
713 |
714 |
715 |
716 |
717 |
718 |
719 |
720 |
721 |
722 |
723 | Must set JVM to use for profiling in profiler.info.jvm
724 | Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
725 |
726 |
729 |
730 |
731 |
732 |
733 |
734 |
735 |
736 |
737 |
738 |
739 |
740 |
741 |
742 |
743 |
744 |
745 |
746 |
747 |
748 |
749 |
750 |
751 |
752 |
753 |
754 |
755 |
756 |
757 |
758 |
759 |
760 |
761 |
762 |
763 |
764 |
765 |
766 |
767 |
768 |
769 |
770 |
771 |
772 |
773 |
774 |
775 |
776 |
777 |
778 |
779 |
780 |
781 |
782 |
783 |
784 |
785 |
786 |
787 |
788 |
789 |
790 |
791 |
792 |
793 |
794 |
795 |
796 |
797 |
798 |
799 |
800 |
801 |
802 |
803 |
804 |
805 |
806 |
807 |
808 |
809 |
810 |
811 |
812 |
813 |
814 |
815 |
816 |
817 |
818 |
819 |
820 |
821 |
822 |
823 |
824 |
825 |
826 |
827 |
828 |
829 |
830 |
831 |
832 |
833 |
834 |
835 |
836 |
837 |
838 |
839 |
840 |
841 |
842 |
843 |
844 |
845 |
846 |
847 |
848 |
849 |
850 |
851 |
852 |
853 |
854 |
855 |
856 |
857 |
858 |
859 |
860 |
861 |
862 |
863 |
864 |
865 |
866 |
867 |
868 |
869 |
870 |
871 |
872 |
873 |
874 |
875 |
876 |
877 |
878 |
879 |
880 |
881 |
882 |
883 |
884 |
885 |
886 |
887 |
892 |
893 |
894 |
895 |
896 |
897 |
898 |
899 |
900 |
901 |
902 |
903 |
904 |
905 |
906 |
907 |
908 |
909 |
910 |
911 |
912 |
913 |
914 |
915 |
916 |
917 |
918 |
919 |
920 |
921 |
922 |
923 |
924 |
925 |
926 |
927 |
928 |
929 |
930 |
931 |
932 |
933 |
934 |
935 |
936 |
937 |
938 |
939 |
940 |
941 |
942 |
943 |
944 |
945 |
946 |
947 |
948 |
949 |
950 |
951 |
952 | Must select some files in the IDE or set javac.includes
953 |
954 |
955 |
956 |
957 |
958 |
959 |
960 |
961 |
966 |
967 |
968 |
969 |
970 |
971 |
972 |
973 |
974 |
975 |
976 |
977 |
978 |
979 |
980 |
981 |
982 |
983 |
984 |
985 |
986 |
987 |
988 |
989 |
990 |
991 |
992 |
993 |
994 |
995 |
996 |
997 |
998 |
999 |
1000 |
1001 |
1002 | To run this application from the command line without Ant, try:
1003 |
1004 | java -jar "${dist.jar.resolved}"
1005 |
1006 |
1007 |
1008 |
1009 |
1010 |
1011 |
1012 |
1013 |
1014 |
1015 |
1016 |
1017 |
1018 |
1019 |
1020 |
1021 |
1022 |
1023 |
1024 |
1025 |
1026 |
1027 |
1028 |
1029 |
1030 |
1031 |
1032 |
1033 |
1034 |
1035 |
1040 |
1041 |
1042 |
1043 |
1044 |
1045 |
1046 |
1047 |
1048 |
1049 |
1050 |
1051 | Must select one file in the IDE or set run.class
1052 |
1053 |
1054 |
1055 | Must select one file in the IDE or set run.class
1056 |
1057 |
1058 |
1063 |
1064 |
1065 |
1066 |
1067 |
1068 |
1069 |
1070 |
1071 |
1072 |
1073 |
1074 |
1075 |
1076 |
1077 |
1078 |
1079 |
1080 |
1081 |
1082 | Must select one file in the IDE or set debug.class
1083 |
1084 |
1085 |
1086 |
1087 | Must select one file in the IDE or set debug.class
1088 |
1089 |
1090 |
1091 |
1092 | Must set fix.includes
1093 |
1094 |
1095 |
1096 |
1097 |
1098 |
1099 |
1104 |
1107 |
1108 | This target only works when run from inside the NetBeans IDE.
1109 |
1110 |
1111 |
1112 |
1113 |
1114 |
1115 |
1116 |
1117 | Must select one file in the IDE or set profile.class
1118 | This target only works when run from inside the NetBeans IDE.
1119 |
1120 |
1121 |
1122 |
1123 |
1124 |
1125 |
1126 |
1127 | This target only works when run from inside the NetBeans IDE.
1128 |
1129 |
1130 |
1131 |
1132 |
1133 |
1134 |
1135 |
1136 |
1137 |
1138 |
1139 |
1140 | This target only works when run from inside the NetBeans IDE.
1141 |
1142 |
1143 |
1144 |
1145 |
1146 |
1147 |
1148 |
1149 |
1150 |
1151 |
1152 |
1153 |
1154 |
1155 |
1156 |
1157 |
1158 |
1159 |
1160 |
1161 |
1162 |
1165 |
1166 |
1167 |
1168 |
1169 |
1170 |
1171 |
1172 |
1173 |
1174 |
1175 |
1176 |
1177 |
1178 | Must select one file in the IDE or set run.class
1179 |
1180 |
1181 |
1182 |
1183 |
1184 | Must select some files in the IDE or set test.includes
1185 |
1186 |
1187 |
1188 |
1189 | Must select one file in the IDE or set run.class
1190 |
1191 |
1192 |
1193 |
1194 | Must select one file in the IDE or set applet.url
1195 |
1196 |
1197 |
1198 |
1203 |
1204 |
1205 |
1206 |
1207 |
1208 |
1209 |
1210 |
1211 |
1212 |
1213 |
1214 |
1215 |
1216 |
1217 |
1218 |
1219 |
1220 |
1221 |
1222 |
1223 |
1224 |
1225 |
1226 |
1227 |
1228 |
1229 |
1230 |
1231 |
1232 |
1233 |
1234 |
1235 |
1236 |
1237 |
1238 |
1239 |
1240 |
1241 |
1242 |
1247 |
1248 |
1249 |
1250 |
1251 |
1252 |
1253 |
1254 |
1255 |
1256 |
1257 |
1258 |
1259 |
1260 |
1261 |
1262 |
1263 |
1264 |
1265 |
1266 |
1267 |
1268 |
1269 |
1270 |
1271 |
1272 |
1273 | Must select some files in the IDE or set javac.includes
1274 |
1275 |
1276 |
1277 |
1278 |
1279 |
1280 |
1281 |
1282 |
1283 |
1284 |
1285 |
1290 |
1291 |
1292 |
1293 |
1294 |
1295 |
1296 |
1297 | Some tests failed; see details above.
1298 |
1299 |
1300 |
1301 |
1302 |
1303 |
1304 |
1305 |
1306 | Must select some files in the IDE or set test.includes
1307 |
1308 |
1309 |
1310 | Some tests failed; see details above.
1311 |
1312 |
1313 |
1314 | Must select some files in the IDE or set test.class
1315 | Must select some method in the IDE or set test.method
1316 |
1317 |
1318 |
1319 | Some tests failed; see details above.
1320 |
1321 |
1322 |
1327 |
1328 | Must select one file in the IDE or set test.class
1329 |
1330 |
1331 |
1332 | Must select one file in the IDE or set test.class
1333 | Must select some method in the IDE or set test.method
1334 |
1335 |
1336 |
1337 |
1338 |
1339 |
1340 |
1341 |
1342 |
1343 |
1344 |
1345 |
1350 |
1351 | Must select one file in the IDE or set applet.url
1352 |
1353 |
1354 |
1355 |
1356 |
1357 |
1358 |
1363 |
1364 | Must select one file in the IDE or set applet.url
1365 |
1366 |
1367 |
1368 |
1369 |
1370 |
1371 |
1372 |
1377 |
1378 |
1379 |
1380 |
1381 |
1382 |
1383 |
1384 |
1385 |
1386 |
1387 |
1388 |
1389 |
1390 |
1391 |
1392 |
1393 |
1394 |
1395 |
1396 |
1397 |
1398 |
1399 |
1400 |
1401 |
1402 |
1403 |
1404 |
1405 |
1406 |
1407 |
1408 |
1409 |
1410 |
1411 |
1412 |
1413 |
1414 |
1415 |
1416 |
1417 |
1418 |
1419 |
1420 |
1421 |
1422 |
--------------------------------------------------------------------------------
/nbproject/configs/Run_as_WebStart.properties:
--------------------------------------------------------------------------------
1 | # Do not modify this property in this configuration. It can be re-generated.
2 | $label=Run as WebStart
3 |
--------------------------------------------------------------------------------
/nbproject/configs/Run_in_Browser.properties:
--------------------------------------------------------------------------------
1 | # Do not modify this property in this configuration. It can be re-generated.
2 | $label=Run in Browser
3 |
--------------------------------------------------------------------------------
/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=815ab6e1
2 | build.xml.script.CRC32=351b934d
3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=815ab6e1
7 | nbproject/build-impl.xml.script.CRC32=bf2e9b1a
8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
9 |
--------------------------------------------------------------------------------
/nbproject/project.properties:
--------------------------------------------------------------------------------
1 | annotation.processing.enabled=true
2 | annotation.processing.enabled.in.editor=false
3 | annotation.processing.processors.list=
4 | annotation.processing.run.all.processors=true
5 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
6 | application.title=opration-of-table
7 | application.vendor=hocinebouarara
8 | build.classes.dir=${build.dir}/classes
9 | build.classes.excludes=**/*.java,**/*.form
10 | # This directory is removed when the project is cleaned:
11 | build.dir=build
12 | build.generated.dir=${build.dir}/generated
13 | build.generated.sources.dir=${build.dir}/generated-sources
14 | # Only compile against the classpath explicitly listed here:
15 | build.sysclasspath=ignore
16 | build.test.classes.dir=${build.dir}/test/classes
17 | build.test.results.dir=${build.dir}/test/results
18 | compile.on.save=true
19 | compile.on.save.unsupported.javafx=true
20 | # Uncomment to specify the preferred debugger connection transport:
21 | #debug.transport=dt_socket
22 | debug.classpath=\
23 | ${run.classpath}
24 | debug.test.classpath=\
25 | ${run.test.classpath}
26 | # This directory is removed when the project is cleaned:
27 | dist.dir=dist
28 | dist.jar=${dist.dir}/opration-of-table.jar
29 | dist.javadoc.dir=${dist.dir}/javadoc
30 | endorsed.classpath=
31 | excludes=
32 | file.reference.fontawesomefx-8.9.jar=src/libaries_icons/fontawesomefx-8.9.jar
33 | file.reference.jfoenix-8.0.1.jar=src/libaries_icons/jfoenix-8.0.1.jar
34 | file.reference.mysql-connector-java-5.1.42-bin.jar=src/libaries_icons/mysql-connector-java-5.1.42-bin.jar
35 | includes=**
36 | # Non-JavaFX jar file creation is deactivated in JavaFX 2.0+ projects
37 | jar.archive.disabled=true
38 | jar.compress=false
39 | javac.classpath=\
40 | ${javafx.classpath.extension}:\
41 | ${file.reference.fontawesomefx-8.9.jar}:\
42 | ${file.reference.jfoenix-8.0.1.jar}:\
43 | ${file.reference.mysql-connector-java-5.1.42-bin.jar}
44 | # Space-separated list of extra javac options
45 | javac.compilerargs=
46 | javac.deprecation=false
47 | javac.external.vm=false
48 | javac.processorpath=\
49 | ${javac.classpath}
50 | javac.source=1.8
51 | javac.target=1.8
52 | javac.test.classpath=\
53 | ${javac.classpath}:\
54 | ${build.classes.dir}
55 | javac.test.processorpath=\
56 | ${javac.test.classpath}
57 | javadoc.additionalparam=
58 | javadoc.author=false
59 | javadoc.encoding=${source.encoding}
60 | javadoc.noindex=false
61 | javadoc.nonavbar=false
62 | javadoc.notree=false
63 | javadoc.private=false
64 | javadoc.splitindex=true
65 | javadoc.use=true
66 | javadoc.version=false
67 | javadoc.windowtitle=
68 | javafx.application.implementation.version=1.0
69 | javafx.binarycss=false
70 | javafx.classpath.extension=\
71 | ${java.home}/lib/javaws.jar:\
72 | ${java.home}/lib/deploy.jar:\
73 | ${java.home}/lib/plugin.jar
74 | javafx.deploy.allowoffline=true
75 | # If true, application update mode is set to 'background', if false, update mode is set to 'eager'
76 | javafx.deploy.backgroundupdate=false
77 | javafx.deploy.embedJNLP=true
78 | javafx.deploy.includeDT=true
79 | # Set true to prevent creation of temporary copy of deployment artifacts before each run (disables concurrent runs)
80 | javafx.disable.concurrent.runs=false
81 | # Set true to enable multiple concurrent runs of the same WebStart or Run-in-Browser project
82 | javafx.enable.concurrent.external.runs=false
83 | # This is a JavaFX project
84 | javafx.enabled=true
85 | javafx.fallback.class=com.javafx.main.NoJavaFXFallback
86 | # Main class for JavaFX
87 | javafx.main.class=operationtable.OperationTable
88 | javafx.preloader.class=
89 | # This project does not use Preloader
90 | javafx.preloader.enabled=false
91 | javafx.preloader.jar.filename=
92 | javafx.preloader.jar.path=
93 | javafx.preloader.project.path=
94 | javafx.preloader.type=none
95 | # Set true for GlassFish only. Rebases manifest classpaths of JARs in lib dir. Not usable with signed JARs.
96 | javafx.rebase.libs=false
97 | javafx.run.height=600
98 | javafx.run.width=800
99 | # Pre-JavaFX 2.0 WebStart is deactivated in JavaFX 2.0+ projects
100 | jnlp.enabled=false
101 | # Main class for Java launcher
102 | main.class=com.javafx.main.Main
103 | # For improved security specify narrower Codebase manifest attribute to prevent RIAs from being repurposed
104 | manifest.custom.codebase=*
105 | # Specify Permissions manifest attribute to override default (choices: sandbox, all-permissions)
106 | manifest.custom.permissions=
107 | manifest.file=manifest.mf
108 | meta.inf.dir=${src.dir}/META-INF
109 | mkdist.disabled=false
110 | platform.active=default_platform
111 | run.classpath=\
112 | ${dist.jar}:\
113 | ${javac.classpath}:\
114 | ${build.classes.dir}
115 | run.test.classpath=\
116 | ${javac.test.classpath}:\
117 | ${build.test.classes.dir}
118 | source.encoding=UTF-8
119 | src.dir=src
120 | test.src.dir=test
121 |
--------------------------------------------------------------------------------
/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | opration-of-table
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/database/school.sql:
--------------------------------------------------------------------------------
1 | -- phpMyAdmin SQL Dump
2 | -- version 4.8.5
3 | -- https://www.phpmyadmin.net/
4 | --
5 | -- Host: 127.0.0.1
6 | -- Generation Time: Mar 11, 2021 at 11:47 AM
7 | -- Server version: 10.1.38-MariaDB
8 | -- PHP Version: 7.3.2
9 |
10 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
11 | SET AUTOCOMMIT = 0;
12 | START TRANSACTION;
13 | SET time_zone = "+00:00";
14 |
15 |
16 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
17 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
18 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
19 | /*!40101 SET NAMES utf8mb4 */;
20 |
21 | --
22 | -- Database: `school`
23 | --
24 |
25 | -- --------------------------------------------------------
26 |
27 | --
28 | -- Table structure for table `student`
29 | --
30 |
31 | CREATE TABLE `student` (
32 | `id` int(11) NOT NULL,
33 | `name` varchar(30) NOT NULL,
34 | `birth` date NOT NULL,
35 | `adress` varchar(50) NOT NULL,
36 | `email` varchar(30) NOT NULL
37 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
38 |
39 | --
40 | -- Dumping data for table `student`
41 | --
42 |
43 | INSERT INTO `student` (`id`, `name`, `birth`, `adress`, `email`) VALUES
44 | (1, 'hocine bouarara', '1995-09-02', 'lardjem', 'hocine@univ-tiaret.dz'),
45 | (2, 'abdelbasset br', '2010-10-12', 'lardjem', 'abdo@gmail.dz');
46 |
47 | --
48 | -- Indexes for dumped tables
49 | --
50 |
51 | --
52 | -- Indexes for table `student`
53 | --
54 | ALTER TABLE `student`
55 | ADD PRIMARY KEY (`id`);
56 |
57 | --
58 | -- AUTO_INCREMENT for dumped tables
59 | --
60 |
61 | --
62 | -- AUTO_INCREMENT for table `student`
63 | --
64 | ALTER TABLE `student`
65 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
66 | COMMIT;
67 |
68 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
69 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
70 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
71 |
--------------------------------------------------------------------------------
/src/helpers/DbConnect.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package helpers;
7 |
8 | import java.sql.Connection;
9 | import java.sql.DriverManager;
10 | import java.sql.SQLException;
11 | import java.util.logging.Level;
12 | import java.util.logging.Logger;
13 |
14 |
15 |
16 | /**
17 | *
18 | * @author hocin
19 | */
20 | public class DbConnect {
21 |
22 | private static String HOST = "127.0.0.1";
23 | private static int PORT = 3306;
24 | private static String DB_NAME = "school";
25 | private static String USERNAME = "root";
26 | private static String PASSWORD = "";
27 | private static Connection connection ;
28 |
29 |
30 | public static Connection getConnect (){
31 | try {
32 | connection = DriverManager.getConnection(String.format("jdbc:mysql://%s:%d/%s", HOST,PORT,DB_NAME),USERNAME,PASSWORD);
33 | } catch (SQLException ex) {
34 | Logger.getLogger(DbConnect.class.getName()).log(Level.SEVERE, null, ex);
35 | }
36 |
37 | return connection;
38 | }
39 |
40 |
41 |
42 |
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/libaries_icons/fontawesomefx-8.9.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hocinebouarara/crud-operations-using-java-and-mysql/f46c4ef33c4c4680ae5f0edee69143822f30e083/src/libaries_icons/fontawesomefx-8.9.jar
--------------------------------------------------------------------------------
/src/libaries_icons/fontawesomefx-glyphsbrowser-all-1.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hocinebouarara/crud-operations-using-java-and-mysql/f46c4ef33c4c4680ae5f0edee69143822f30e083/src/libaries_icons/fontawesomefx-glyphsbrowser-all-1.0.jar
--------------------------------------------------------------------------------
/src/libaries_icons/jfoenix-8.0.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hocinebouarara/crud-operations-using-java-and-mysql/f46c4ef33c4c4680ae5f0edee69143822f30e083/src/libaries_icons/jfoenix-8.0.1.jar
--------------------------------------------------------------------------------
/src/libaries_icons/mysql-connector-java-5.1.42-bin.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hocinebouarara/crud-operations-using-java-and-mysql/f46c4ef33c4c4680ae5f0edee69143822f30e083/src/libaries_icons/mysql-connector-java-5.1.42-bin.jar
--------------------------------------------------------------------------------
/src/models/Student.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package models;
7 |
8 | import java.sql.Date;
9 |
10 | /**
11 | *
12 | * @author hocin
13 | */
14 | public class Student {
15 |
16 |
17 | int id ;
18 | String name ;
19 | Date birth ;
20 | String adress ,email ;
21 |
22 | public Student(int id, String name, Date birth, String adress, String email) {
23 | this.id = id;
24 | this.name = name;
25 | this.birth = birth;
26 | this.adress = adress;
27 | this.email = email;
28 | }
29 |
30 | public int getId() {
31 | return id;
32 | }
33 |
34 | public void setId(int id) {
35 | this.id = id;
36 | }
37 |
38 | public String getName() {
39 | return name;
40 | }
41 |
42 | public void setName(String name) {
43 | this.name = name;
44 | }
45 |
46 | public Date getBirth() {
47 | return birth;
48 | }
49 |
50 | public void setBirth(Date birth) {
51 | this.birth = birth;
52 | }
53 |
54 | public String getAdress() {
55 | return adress;
56 | }
57 |
58 | public void setAdress(String adress) {
59 | this.adress = adress;
60 | }
61 |
62 | public String getEmail() {
63 | return email;
64 | }
65 |
66 | public void setEmail(String email) {
67 | this.email = email;
68 | }
69 |
70 |
71 |
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/src/operationtable/OperationTable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package operationtable;
7 |
8 | import java.io.IOException;
9 | import java.util.logging.Level;
10 | import java.util.logging.Logger;
11 | import javafx.application.Application;
12 | import javafx.event.ActionEvent;
13 | import javafx.event.EventHandler;
14 | import javafx.fxml.FXMLLoader;
15 | import javafx.scene.Parent;
16 | import javafx.scene.Scene;
17 | import javafx.scene.control.Button;
18 | import javafx.scene.layout.StackPane;
19 | import javafx.scene.paint.Color;
20 | import javafx.stage.Stage;
21 | import javafx.stage.StageStyle;
22 |
23 | /**
24 | *
25 | * @author hocin
26 | */
27 | public class OperationTable extends Application {
28 |
29 | @Override
30 | public void start(Stage primaryStage) {
31 | try {
32 | Parent parent = FXMLLoader.load(getClass().getResource("/tableView/tableView.fxml"));
33 | Scene scene = new Scene(parent);
34 | scene.setFill(Color.TRANSPARENT);
35 | primaryStage.setScene(scene);
36 | primaryStage.initStyle(StageStyle.TRANSPARENT);
37 | primaryStage.show();
38 | } catch (IOException ex) {
39 | Logger.getLogger(OperationTable.class.getName()).log(Level.SEVERE, null, ex);
40 | }
41 | }
42 |
43 | /**
44 | * @param args the command line arguments
45 | */
46 | public static void main(String[] args) {
47 | launch(args);
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/src/tableView/AddStudentController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package tableView;
7 |
8 | import com.jfoenix.controls.JFXDatePicker;
9 | import com.jfoenix.controls.JFXTextField;
10 | import helpers.DbConnect;
11 | import java.net.URL;
12 | import java.sql.Connection;
13 | import java.sql.PreparedStatement;
14 | import java.sql.ResultSet;
15 | import java.sql.SQLException;
16 | import java.time.LocalDate;
17 | import java.util.ResourceBundle;
18 | import java.util.logging.Level;
19 | import java.util.logging.Logger;
20 | import javafx.fxml.FXML;
21 | import javafx.fxml.Initializable;
22 | import javafx.scene.control.Alert;
23 | import javafx.scene.input.MouseEvent;
24 | import models.Student;
25 |
26 | /**
27 | * FXML Controller class
28 | *
29 | * @author hocin
30 | */
31 | public class AddStudentController implements Initializable {
32 |
33 | @FXML
34 | private JFXTextField nameFld;
35 | @FXML
36 | private JFXDatePicker birthFld;
37 | @FXML
38 | private JFXTextField adressFld;
39 | @FXML
40 | private JFXTextField emailFld;
41 |
42 | String query = null;
43 | Connection connection = null;
44 | ResultSet resultSet = null;
45 | PreparedStatement preparedStatement;
46 | Student student = null;
47 | private boolean update;
48 | int studentId;
49 |
50 | /**
51 | * Initializes the controller class.
52 | */
53 | @Override
54 | public void initialize(URL url, ResourceBundle rb) {
55 | // TODO
56 | }
57 |
58 | @FXML
59 | private void save(MouseEvent event) {
60 |
61 | connection = DbConnect.getConnect();
62 | String name = nameFld.getText();
63 | String birth = String.valueOf(birthFld.getValue());
64 | String adress = adressFld.getText();
65 | String email = emailFld.getText();
66 |
67 | if (name.isEmpty() || birth.isEmpty() || adress.isEmpty() || email.isEmpty()) {
68 | Alert alert = new Alert(Alert.AlertType.ERROR);
69 | alert.setHeaderText(null);
70 | alert.setContentText("Please Fill All DATA");
71 | alert.showAndWait();
72 |
73 | } else {
74 | getQuery();
75 | insert();
76 | clean();
77 |
78 | }
79 |
80 | }
81 |
82 | @FXML
83 | private void clean() {
84 | nameFld.setText(null);
85 | birthFld.setValue(null);
86 | adressFld.setText(null);
87 | emailFld.setText(null);
88 |
89 | }
90 |
91 | private void getQuery() {
92 |
93 | if (update == false) {
94 |
95 | query = "INSERT INTO `student`( `name`, `birth`, `adress`, `email`) VALUES (?,?,?,?)";
96 |
97 | }else{
98 | query = "UPDATE `student` SET "
99 | + "`name`=?,"
100 | + "`birth`=?,"
101 | + "`adress`=?,"
102 | + "`email`= ? WHERE id = '"+studentId+"'";
103 | }
104 |
105 | }
106 |
107 | private void insert() {
108 |
109 | try {
110 |
111 | preparedStatement = connection.prepareStatement(query);
112 | preparedStatement.setString(1, nameFld.getText());
113 | preparedStatement.setString(2, String.valueOf(birthFld.getValue()));
114 | preparedStatement.setString(3, adressFld.getText());
115 | preparedStatement.setString(4, emailFld.getText());
116 | preparedStatement.execute();
117 |
118 | } catch (SQLException ex) {
119 | Logger.getLogger(AddStudentController.class.getName()).log(Level.SEVERE, null, ex);
120 | }
121 |
122 | }
123 |
124 | void setTextField(int id, String name, LocalDate toLocalDate, String adress, String email) {
125 |
126 | studentId = id;
127 | nameFld.setText(name);
128 | birthFld.setValue(toLocalDate);
129 | adressFld.setText(adress);
130 | emailFld.setText(email);
131 |
132 | }
133 |
134 | void setUpdate(boolean b) {
135 | this.update = b;
136 |
137 | }
138 |
139 | }
140 |
--------------------------------------------------------------------------------
/src/tableView/TableViewController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package tableView;
7 |
8 | import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon;
9 | import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView;
10 | import helpers.DbConnect;
11 | import java.io.IOException;
12 | import java.net.URL;
13 | import java.sql.Connection;
14 | import java.sql.PreparedStatement;
15 | import java.sql.ResultSet;
16 | import java.sql.SQLException;
17 | import java.time.LocalDate;
18 | import java.util.Observable;
19 | import java.util.ResourceBundle;
20 | import java.util.logging.Level;
21 | import java.util.logging.Logger;
22 | import javafx.collections.FXCollections;
23 | import javafx.collections.ObservableList;
24 | import javafx.fxml.FXML;
25 | import javafx.fxml.FXMLLoader;
26 | import javafx.fxml.Initializable;
27 | import javafx.geometry.Insets;
28 | import javafx.scene.Node;
29 | import javafx.scene.Parent;
30 | import javafx.scene.Scene;
31 | import javafx.scene.control.TableCell;
32 | import javafx.scene.control.TableColumn;
33 | import javafx.scene.control.TableView;
34 | import javafx.scene.control.cell.PropertyValueFactory;
35 | import javafx.scene.input.MouseEvent;
36 | import javafx.scene.layout.HBox;
37 | import javafx.stage.Stage;
38 | import javafx.stage.StageStyle;
39 | import javafx.util.Callback;
40 | import jdk.nashorn.internal.objects.annotations.Property;
41 | import models.Student;
42 |
43 | /**
44 | * FXML Controller class
45 | *
46 | * @author hocin
47 | */
48 | public class TableViewController implements Initializable {
49 |
50 | @FXML
51 | private TableView studentsTable;
52 | @FXML
53 | private TableColumn idCol;
54 | @FXML
55 | private TableColumn nameCol;
56 | @FXML
57 | private TableColumn birthCol;
58 | @FXML
59 | private TableColumn adressCol;
60 | @FXML
61 | private TableColumn emailCol;
62 | @FXML
63 | private TableColumn editCol;
64 |
65 | String query = null;
66 | Connection connection = null ;
67 | PreparedStatement preparedStatement = null ;
68 | ResultSet resultSet = null ;
69 | Student student = null ;
70 |
71 | ObservableList StudentList = FXCollections.observableArrayList();
72 |
73 | /**
74 | * Initializes the controller class.
75 | */
76 | @Override
77 | public void initialize(URL url, ResourceBundle rb) {
78 | // TODO
79 | loadDate();
80 | }
81 |
82 |
83 |
84 |
85 | @FXML
86 | private void close(MouseEvent event) {
87 | Stage stage = (Stage)((Node) event.getSource()).getScene().getWindow();
88 | stage.close();
89 | }
90 |
91 | @FXML
92 | private void getAddView(MouseEvent event) {
93 | try {
94 | Parent parent = FXMLLoader.load(getClass().getResource("/tableView/addStudent.fxml"));
95 | Scene scene = new Scene(parent);
96 | Stage stage = new Stage();
97 | stage.setScene(scene);
98 | stage.initStyle(StageStyle.UTILITY);
99 | stage.show();
100 | } catch (IOException ex) {
101 | Logger.getLogger(TableViewController.class.getName()).log(Level.SEVERE, null, ex);
102 | }
103 |
104 | }
105 |
106 | @FXML
107 | private void refreshTable() {
108 | try {
109 | StudentList.clear();
110 |
111 | query = "SELECT * FROM `student`";
112 | preparedStatement = connection.prepareStatement(query);
113 | resultSet = preparedStatement.executeQuery();
114 |
115 | while (resultSet.next()){
116 | StudentList.add(new Student(
117 | resultSet.getInt("id"),
118 | resultSet.getString("name"),
119 | resultSet.getDate("birth"),
120 | resultSet.getString("adress"),
121 | resultSet.getString("email")));
122 | studentsTable.setItems(StudentList);
123 |
124 | }
125 |
126 |
127 | } catch (SQLException ex) {
128 | Logger.getLogger(TableViewController.class.getName()).log(Level.SEVERE, null, ex);
129 | }
130 |
131 |
132 |
133 | }
134 |
135 | @FXML
136 | private void print(MouseEvent event) {
137 | }
138 |
139 | private void loadDate() {
140 |
141 | connection = DbConnect.getConnect();
142 | refreshTable();
143 |
144 | idCol.setCellValueFactory(new PropertyValueFactory<>("id"));
145 | nameCol.setCellValueFactory(new PropertyValueFactory<>("name"));
146 | birthCol.setCellValueFactory(new PropertyValueFactory<>("birth"));
147 | adressCol.setCellValueFactory(new PropertyValueFactory<>("adress"));
148 | emailCol.setCellValueFactory(new PropertyValueFactory<>("email"));
149 |
150 | //add cell of button edit
151 | Callback, TableCell> cellFoctory = (TableColumn param) -> {
152 | // make cell containing buttons
153 | final TableCell cell = new TableCell() {
154 | @Override
155 | public void updateItem(String item, boolean empty) {
156 | super.updateItem(item, empty);
157 | //that cell created only on non-empty rows
158 | if (empty) {
159 | setGraphic(null);
160 | setText(null);
161 |
162 | } else {
163 |
164 | FontAwesomeIconView deleteIcon = new FontAwesomeIconView(FontAwesomeIcon.TRASH);
165 | FontAwesomeIconView editIcon = new FontAwesomeIconView(FontAwesomeIcon.PENCIL_SQUARE);
166 |
167 | deleteIcon.setStyle(
168 | " -fx-cursor: hand ;"
169 | + "-glyph-size:28px;"
170 | + "-fx-fill:#ff1744;"
171 | );
172 | editIcon.setStyle(
173 | " -fx-cursor: hand ;"
174 | + "-glyph-size:28px;"
175 | + "-fx-fill:#00E676;"
176 | );
177 | deleteIcon.setOnMouseClicked((MouseEvent event) -> {
178 |
179 | try {
180 | student = studentsTable.getSelectionModel().getSelectedItem();
181 | query = "DELETE FROM `student` WHERE id ="+student.getId();
182 | connection = DbConnect.getConnect();
183 | preparedStatement = connection.prepareStatement(query);
184 | preparedStatement.execute();
185 | refreshTable();
186 |
187 | } catch (SQLException ex) {
188 | Logger.getLogger(TableViewController.class.getName()).log(Level.SEVERE, null, ex);
189 | }
190 |
191 |
192 |
193 |
194 |
195 | });
196 | editIcon.setOnMouseClicked((MouseEvent event) -> {
197 |
198 | student = studentsTable.getSelectionModel().getSelectedItem();
199 | FXMLLoader loader = new FXMLLoader ();
200 | loader.setLocation(getClass().getResource("/tableView/addStudent.fxml"));
201 | try {
202 | loader.load();
203 | } catch (IOException ex) {
204 | Logger.getLogger(TableViewController.class.getName()).log(Level.SEVERE, null, ex);
205 | }
206 |
207 | AddStudentController addStudentController = loader.getController();
208 | addStudentController.setUpdate(true);
209 | addStudentController.setTextField(student.getId(), student.getName(),
210 | student.getBirth().toLocalDate(),student.getAdress(), student.getEmail());
211 | Parent parent = loader.getRoot();
212 | Stage stage = new Stage();
213 | stage.setScene(new Scene(parent));
214 | stage.initStyle(StageStyle.UTILITY);
215 | stage.show();
216 |
217 |
218 |
219 |
220 | });
221 |
222 | HBox managebtn = new HBox(editIcon, deleteIcon);
223 | managebtn.setStyle("-fx-alignment:center");
224 | HBox.setMargin(deleteIcon, new Insets(2, 2, 0, 3));
225 | HBox.setMargin(editIcon, new Insets(2, 3, 0, 2));
226 |
227 | setGraphic(managebtn);
228 |
229 | setText(null);
230 |
231 | }
232 | }
233 |
234 | };
235 |
236 | return cell;
237 | };
238 | editCol.setCellFactory(cellFoctory);
239 | studentsTable.setItems(StudentList);
240 |
241 |
242 | }
243 |
244 | }
245 |
--------------------------------------------------------------------------------
/src/tableView/addStudent.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
--------------------------------------------------------------------------------
/src/tableView/tableView.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/src/tableView/tableview.css:
--------------------------------------------------------------------------------
1 | .btn:hover{
2 | -fx-cursor:hand ;
3 | }
4 | .table-view {
5 | -fx-background-color:#651FFF;
6 | -fx-background-radius:14 14 0 0;
7 |
8 | }
9 | .table-view .column-header-background{
10 | -fx-background-color: #651FFF;
11 | -fx-background-radius:14;
12 | -fx-background-insets: 0 0 10 0;
13 |
14 |
15 |
16 | }
17 | .table-view .column-header, .table-view .filler{
18 | -fx-size:50px;
19 | -fx-border-width: 0 0 10 0;
20 | -fx-background-color:transparent;
21 |
22 | }
23 |
24 | .table-view .column-header .label {
25 | -fx-text-fill: white ;
26 | }
27 |
--------------------------------------------------------------------------------