· 8 years ago · Jan 10, 2018, 06:48 PM
1package Database;
2
3import Model.Cats;
4
5import java.sql.*;
6import java.util.LinkedList;
7import java.util.List;
8
9
10public class Database {
11
12public static final String Driver = "org.sqlite.JDBC";
13public static final String DB_url = "jdbc:sqlite:DB/ShelterDB.db/";
14
15private Connection connection;
16private Statement statement;
17
18public Database() {
19
20 try {
21 Class.forName(Database.Driver);
22 } catch (ClassNotFoundException e) {
23 System.out.println("No driver JDBC");
24 e.printStackTrace();
25 }
26
27 try {
28 connection = DriverManager.getConnection(DB_url);
29 statement = connection.createStatement();
30 } catch (SQLException e) {
31 System.out.println("Problem with opening the connection");
32 e.printStackTrace();
33 }
34 createTables();
35}
36
37public boolean createTables() {
38 String createCats = "CREATE TABLE IF NOT EXISTS Cats (Cat_id INTEGER PRIMARY KEY AUTOINCREMENT,name varchar(255), race varchar(255), gender varchar(255), coat_color varchar(255),age int)";
39 String createDogs = "CREATE TABLE IF NOT EXISTS Dogs (Dog_id INTEGER PRIMARY KEY AUTOINCREMENT,name varchar(255), race varchar(255), gender varchar(255), coat_color varchar(255),age int)";
40 String createManagments = "CREATE TABLE IF NOT EXISTS Managment (Managment_id INTEGER PRIMARY KEY AUTOINCREMENT, name varchar(255), surname varchar(255), username varchar(255), password varchar(255), telephone_number int)";
41 String createEmployes = "CREATE TABLE IF NOT EXISTS Employes (Employe_id INTEGER PRIMARY KEY AUTOINCREMENT, name varchar(255), surname varchar(255), age int, city varchar(255), street varchar(255), house_number int, education varchar(255), telephone_number int, sallary double)";
42 String createStatus = "CREATE TABLE IF NOT EXISTS Status (foodForCats int, foodForDogs int, water int, equipment int, placesForCats int, placesForDogs int)";
43
44 try {
45 statement.execute(createCats);
46 statement.execute(createDogs);
47 statement.execute(createManagments);
48 statement.execute(createEmployes);
49 statement.execute(createStatus);
50 } catch (SQLException e) {
51 System.out.println("Problem with creating a table");
52 e.printStackTrace();
53 return false;
54 }
55 return true;
56}
57
58public boolean insertCat(int id,String name, String race, String gender, String coat_color, int age) {
59 try {
60 PreparedStatement preparedStatement = connection.prepareStatement("insert into Cats values (NULL,?,?,?,?,?);");
61 preparedStatement.setString(1, name);
62 preparedStatement.setString(2, race);
63 preparedStatement.setString(3, gender);
64 preparedStatement.setString(4, coat_color);
65 preparedStatement.setInt(5, age);
66 preparedStatement.execute();
67 } catch (SQLException e) {
68 System.out.println("Error with insert an cat to the table");
69 e.printStackTrace();
70 return false;
71 }
72 return true;
73}
74
75public boolean insertDog(String name, String race, String gender, String coat_color, int age) {
76
77 try {
78 PreparedStatement preparedStatement = connection.prepareStatement("insert into Dogs values (NULL,?,?,?,?,?);");
79 preparedStatement.setString(1, name);
80 preparedStatement.setString(2, race);
81 preparedStatement.setString(3, gender);
82 preparedStatement.setString(4, coat_color);
83 preparedStatement.setInt(5, age);
84 preparedStatement.execute();
85 } catch (SQLException e) {
86 System.out.println("Error with insert an dog to the table");
87 e.printStackTrace();
88 return false;
89 }
90 return true;
91}
92
93public boolean insertManagment(String name, String surname, String username, String password, int telephone_number) {
94 try {
95 PreparedStatement preparedStatement = connection.prepareStatement("insert into Managment values (NULL,?,?,?,?,?);");
96 preparedStatement.setString(1, name);
97 preparedStatement.setString(2, surname);
98 preparedStatement.setString(3, username);
99 preparedStatement.setString(4, password);
100 preparedStatement.setInt(5, telephone_number);
101 preparedStatement.execute();
102 } catch (SQLException e) {
103 System.out.println("Error with insert an managment to the table");
104 e.printStackTrace();
105 return false;
106 }
107 return true;
108}
109
110public boolean insertEmployes(String name, String surname, int age, String city, String street, int house_number, String education, int telephone_number, double sallary) {
111 try {
112 PreparedStatement preparedStatement = connection.prepareStatement("insert into Employees values (NULL,?,?,?,?,?,?,?,?,?);");
113 preparedStatement.setString(1,name);
114 preparedStatement.setString(2,surname);
115 preparedStatement.setInt(3,age);
116 preparedStatement.setString(4,city);
117 preparedStatement.setString(5,street);
118 preparedStatement.setInt(6,house_number);
119 preparedStatement.setString(7,education);
120 preparedStatement.setInt(8,telephone_number);
121 preparedStatement.setDouble(9,sallary);
122 preparedStatement.execute();
123 } catch (SQLException e) {
124 System.out.println("Error with insert an employee to the table");
125 e.printStackTrace();
126 return false;
127 }
128 return true;
129}
130
131
132public boolean insertStatus(int foodForCats, int foodForDogs, int water, int equipment, int placesForCats, int placesForDogs){
133 try {
134 PreparedStatement preparedStatement = connection.prepareStatement("insert into status values (?,?,?,?,?,?);");
135 preparedStatement.setInt(1,foodForCats);
136 preparedStatement.setInt(2,foodForDogs);
137 preparedStatement.setInt(3,water);
138 preparedStatement.setInt(4,equipment);
139 preparedStatement.setInt(5,placesForCats);
140 preparedStatement.setInt(6,placesForDogs);
141 preparedStatement.execute();
142 }catch (SQLException e){
143 System.out.println("Error with insert values into Status");
144 e.printStackTrace();
145 return false;
146 }
147 return true;
148}
149
150public boolean updateCats(Cats cats){
151 try {
152 String updateData = "UPDATE Cats SET name=?, race=?, gender=?, coat_color=?, age=?";
153 PreparedStatement preparedStatement = connection.prepareStatement(updateData);
154 preparedStatement.setString(1,cats.getName());
155 preparedStatement.setString(2,cats.getRace());
156 preparedStatement.setString(3,cats.getGender());
157 preparedStatement.setString(4,cats.getCoatColor());
158 preparedStatement.setInt(5,cats.getAge());
159 int res = preparedStatement.executeUpdate();
160 return (res>0);
161 }catch (SQLException e){
162 System.out.println("Can't update datan"+e.getMessage());
163 }
164 return false;
165}
166
167public ResultSet execQuery(String query){
168 ResultSet resultSet;
169 try {
170 statement = connection.createStatement();
171 resultSet = statement.executeQuery(query);
172 }catch (SQLException e){
173 System.out.println("Error in exec queryn"+e.getMessage());
174 return null;
175 }finally {
176 }
177 return resultSet;
178}
179
180public boolean execAction(String qu){
181 try {
182 statement = connection.createStatement();
183 statement.execute(qu);
184 return true;
185 }catch (SQLException e){
186 System.out.println("excecption at exec actionn"+e.getMessage());
187 return false;
188 }finally {
189
190 }
191}
192
193public void closeConnection() {
194 try {
195 connection.close();
196 } catch (SQLException e) {
197 System.err.println("Error with shutdown");
198 e.printStackTrace();
199 }
200}
201
202package Model;
203
204
205
206import javafx.beans.property.*;
207
208public class Cats {
209
210
211public Cats(Integer id,String name, String race, String gender, String coatColor, Integer age) {
212 this.id = new SimpleIntegerProperty(id);
213 this.name = new SimpleStringProperty(name);
214 this.race = new SimpleStringProperty(race);
215 this.gender = new SimpleStringProperty(gender);
216 this.coatColor = new SimpleStringProperty(coatColor);
217 this.age = new SimpleIntegerProperty(age);
218}
219
220public IntegerProperty id;
221public IntegerProperty IDproperty(){return id;}
222public Integer getID(){return IDproperty().get();}
223
224public StringProperty name;
225
226public void setName(String value) {
227 nameProperty().set(value);
228}
229
230public StringProperty nameProperty() {
231 return name;
232}
233
234public String getName() {
235 return nameProperty().get();
236}
237
238public StringProperty race;
239
240public void setRace(String value) {
241 raceProperty().set(value);
242}
243
244public StringProperty raceProperty() {
245 return race;
246}
247
248public String getRace() {
249 return raceProperty().get();
250}
251
252public StringProperty gender;
253
254public void setGender(String value) {
255 genderProperty().set(value);
256}
257
258public StringProperty genderProperty() {
259 return gender;
260}
261
262public String getGender() {
263 return genderProperty().get();
264}
265
266
267public StringProperty coatColor;
268
269public void setCoatColor(String value) {
270 coatColorProperty().set(value);
271}
272
273public StringProperty coatColorProperty() {
274 return coatColor;
275}
276
277public String getCoatColor() {
278 return coatColorProperty().get();
279}
280
281
282public IntegerProperty age;
283
284public void setAge(Integer value) {
285 ageProperty().set(value);
286}
287
288public IntegerProperty ageProperty() {
289 return age;
290}
291
292public Integer getAge() {
293 return ageProperty().get();
294}
295
296}
297
298package Animals.Cats.retrieveCats;
299
300import Animals.Cats.editCat.editCatController;
301import Database.Database;
302
303import Model.Cats;
304import javafx.beans.property.SimpleIntegerProperty;
305import javafx.beans.property.SimpleStringProperty;
306import javafx.collections.FXCollections;
307import javafx.collections.ObservableList;
308import javafx.event.ActionEvent;
309import javafx.fxml.FXML;
310
311import javafx.fxml.FXMLLoader;
312import javafx.fxml.Initializable;
313import javafx.scene.Node;
314import javafx.scene.Parent;
315import javafx.scene.Scene;
316import javafx.scene.control.TableColumn;
317import javafx.scene.control.TableView;
318import javafx.scene.control.cell.PropertyValueFactory;
319import javafx.scene.layout.AnchorPane;
320import javafx.stage.Stage;
321
322import java.io.IOException;
323import java.net.URL;
324import java.sql.ResultSet;
325import java.sql.SQLException;
326import java.util.ResourceBundle;
327
328
329public class retrieveCatsController implements Initializable {
330
331 ObservableList<Cats> list = FXCollections.observableArrayList();
332
333 @FXML
334 private AnchorPane tableRootPanel; //?
335
336 @FXML
337 private TableView<Cats> tableView;
338
339 @FXML
340 private TableColumn<Cats,Integer> catsId;
341
342 @FXML
343 private TableColumn<Cats, String> catsName;
344
345 @FXML
346 private TableColumn<Cats, String> catsRace;
347
348 @FXML
349 private TableColumn<Cats, String> catsGender;
350
351 @FXML
352 private TableColumn<Cats, String> catsCoatColor;
353
354 @FXML
355 private TableColumn<Cats, Integer> catsAge;
356
357 public void editCats(ActionEvent actionEvent) {
358
359 Cats editSelectedCat = tableView.getSelectionModel().getSelectedItem();
360 if (editSelectedCat == null) {
361 System.out.println("You have to select object that you want to edit");
362 return;
363 }
364 try {
365 FXMLLoader loader = new FXMLLoader(getClass().getResource("/Animals/Cats/editCat/editCat.fxml"));
366 Parent editCatParent = loader.load();
367 Scene editCatScene = new Scene(editCatParent);
368 Stage stage = (Stage) ((Node) actionEvent.getSource()).getScene().getWindow();
369 stage.setScene(editCatScene);
370 stage.show();
371 } catch (IOException e) {
372 System.out.println("can't load an edit window.n" + e.getMessage());
373 }
374 }
375
376 public void deleteSelectedCat(ActionEvent actionEvent) {
377 ObservableList<Cats> selectedCat, list;
378
379 list = tableView.getItems();
380 selectedCat = tableView.getSelectionModel().getSelectedItems();
381
382 selectedCat.forEach(list::remove);
383 }
384
385 public void goToMainMenuCats(ActionEvent actionEvent) throws IOException {
386 Parent animalsMainMenuParent = FXMLLoader.load(getClass().getResource("/Animals/Cats/mainMenuCats/Cats.fxml"));
387 Scene animalsMainMenuScene = new Scene(animalsMainMenuParent);
388 Stage stage = (Stage) ((Node) actionEvent.getSource()).getScene().getWindow();
389 stage.setScene(animalsMainMenuScene);
390 stage.show();
391 }
392
393 public void goToEmployees(ActionEvent actionEvent) throws IOException {
394 Parent employeesMainMenuParent = FXMLLoader.load(getClass().getResource("/Employees/mainMenu/employeesMain.fxml"));
395 Scene mainMenuScene = new Scene(employeesMainMenuParent);
396 Stage stage = (Stage) ((Node) actionEvent.getSource()).getScene().getWindow();
397 stage.setScene(mainMenuScene);
398 stage.show();
399 }
400
401 public void goToAnimals(ActionEvent actionEvent) throws IOException {
402 Parent goToAnimalsMenuParent = FXMLLoader.load(getClass().getResource("/Animals/mainMenu/animalsMainMenu.fxml"));
403 Scene goToAnimalsMenuScene = new Scene(goToAnimalsMenuParent);
404 Stage goToAnimalsMenuStage = (Stage) ((Node) actionEvent.getSource()).getScene().getWindow();
405 goToAnimalsMenuStage.setScene(goToAnimalsMenuScene);
406 goToAnimalsMenuStage.show();
407 }
408
409 public void goToStatus(ActionEvent actionEvent) throws IOException {
410 Parent goToStatusMenuParent = FXMLLoader.load(getClass().getResource("/Status/Menu/statusMainMenu.fxml"));
411 Scene goToStatusMenuScene = new Scene(goToStatusMenuParent);
412 Stage goToStatusMenuStage = (Stage) ((Node) actionEvent.getSource()).getScene().getWindow();
413 goToStatusMenuStage.setScene(goToStatusMenuScene);
414 goToStatusMenuStage.show();
415 }
416
417
418 @Override
419 public void initialize(URL location, ResourceBundle resources) {
420
421 initColumns();
422 loadData();
423 }
424
425
426 private void initColumns() {
427 catsId.setCellValueFactory(new PropertyValueFactory<>("ID"));
428 catsName.setCellValueFactory(new PropertyValueFactory<>("Name"));
429 catsRace.setCellValueFactory(new PropertyValueFactory<>("Race"));
430 catsGender.setCellValueFactory(new PropertyValueFactory<>("Gender"));
431 catsCoatColor.setCellValueFactory(new PropertyValueFactory<>("coatColor"));
432 catsAge.setCellValueFactory(new PropertyValueFactory<>("Age"));
433 }
434
435 private void loadData() {
436 Database database = new Database();
437 String query = "SELECT * FROM Cats";
438 ResultSet resultSet = database.execQuery(query);
439 try {
440 while (resultSet.next()) {
441
442 Integer ID = resultSet.getInt("ID");
443 String name = resultSet.getString("name");
444 String race = resultSet.getString("race");
445 String gender = resultSet.getString("gender");
446 String coatColor = resultSet.getString("coat_color");
447 Integer age = resultSet.getInt("age");
448
449 list.add(new Cats(ID,name, race, gender, coatColor, age));
450 }
451 } catch (SQLException e) {
452 System.out.println("Can't select data from Catsn" + e.getMessage());
453 }
454 tableView.getItems().setAll(list);
455 }
456}
457
458package Animals.Cats.editCat;
459
460import Animals.Cats.addCats.addCatController;
461import Animals.Cats.retrieveCats.retrieveCatsController;
462import Database.Database;
463import Model.Cats;
464import javafx.collections.FXCollections;
465import javafx.collections.ObservableList;
466import javafx.event.ActionEvent;
467import javafx.fxml.FXML;
468import javafx.fxml.FXMLLoader;
469import javafx.fxml.Initializable;
470import javafx.scene.Node;
471import javafx.scene.Parent;
472import javafx.scene.Scene;
473import javafx.scene.control.TableColumn;
474import javafx.scene.control.TablePosition;
475import javafx.scene.control.TableView;
476import javafx.scene.control.cell.PropertyValueFactory;
477import javafx.scene.control.cell.TextFieldTableCell;
478import javafx.stage.Stage;
479
480
481import java.io.IOException;
482import java.net.URL;
483import java.sql.*;
484import java.util.ResourceBundle;
485
486
487public class editCatController implements Initializable{
488
489private ObservableList<Cats> list = FXCollections.observableArrayList();
490private Database database;
491
492 @FXML
493 private TableView<Cats> table;
494
495 @FXML
496 private TableColumn<Cats,Integer> idCol;
497
498 @FXML
499 private TableColumn<Cats,String> nameCol;
500
501 @FXML
502 private TableColumn<Cats,String> raceCol;
503
504 @FXML
505 private TableColumn<Cats,String> genderCol;
506
507 @FXML
508 private TableColumn<Cats,String> coatColorCol;
509
510 @FXML
511 private TableColumn<Cats,Integer> ageCol;
512
513
514// public void Save(){
515// String updateData = "UPDATE Cats set name=?, race=?, gender=?, coat_color=?, age=?"
516// }
517
518
519 private void loadData() {
520 list.clear();
521 Database database = new Database();
522 String query = "SELECT * FROM Cats";
523 ResultSet resultSet = database.execQuery(query);
524 try {
525 while (resultSet.next()) {
526 Integer ID = resultSet.getInt("ID");
527 String name = resultSet.getString("name");
528 String race = resultSet.getString("race");
529 String gender = resultSet.getString("gender");
530 String coatColor = resultSet.getString("coat_color");
531 Integer age = resultSet.getInt("age");
532
533 list.add(new Cats(ID,name, race, gender, coatColor, age));
534 }
535 } catch (SQLException e) {
536 System.out.println("Can't select data from Catsn" + e.getMessage());
537 }
538 table.getItems().setAll(list);
539 }
540
541 public void changeName(TableColumn.CellEditEvent editEvent){
542
543 Cats cats = table.getSelectionModel().getSelectedItem();
544
545 cats.setName(editEvent.getNewValue().toString());
546
547 }
548
549 public void changeRace(TableColumn.CellEditEvent editEvent){
550
551 Cats cats = table.getSelectionModel().getSelectedItem();
552
553 cats.setRace(editEvent.getNewValue().toString());
554
555 }
556
557 public void changeGender(TableColumn.CellEditEvent editEvent){
558
559 Cats cats = table.getSelectionModel().getSelectedItem();
560
561 cats.setGender(editEvent.getNewValue().toString());
562
563 }
564
565 public void changeCoatColor(TableColumn.CellEditEvent editEvent){
566
567 Cats cats = table.getSelectionModel().getSelectedItem();
568
569 cats.setCoatColor(editEvent.getNewValue().toString());
570
571 }
572
573 public void changeAge(TableColumn.CellEditEvent editEvent){
574
575 Cats cats = table.getSelectionModel().getSelectedItem();
576
577 cats.setAge((Integer) editEvent.getNewValue());
578
579 }
580
581 private void initColumns() {
582 idCol.setCellValueFactory(new PropertyValueFactory<>("ID"));
583 nameCol.setCellValueFactory(new PropertyValueFactory<>("Name"));
584 raceCol.setCellValueFactory(new PropertyValueFactory<>("Race"));
585 genderCol.setCellValueFactory(new PropertyValueFactory<>("Gender"));
586 coatColorCol.setCellValueFactory(new PropertyValueFactory<>("coatColor"));
587 ageCol.setCellValueFactory(new PropertyValueFactory<>("Age"));
588 }
589
590
591 @Override
592 public void initialize(URL location, ResourceBundle resources) {
593
594 database = new Database();
595 initColumns();
596 loadData();
597
598 table.setEditable(true);
599
600 nameCol.setCellFactory(TextFieldTableCell.forTableColumn());
601 raceCol.setCellFactory(TextFieldTableCell.forTableColumn());
602 genderCol.setCellFactory(TextFieldTableCell.forTableColumn());
603 coatColorCol.setCellFactory(TextFieldTableCell.forTableColumn());
604
605
606
607 }
608
609 public void test(ActionEvent actionEvent) throws IOException {
610 Parent animalsMainMenuParent = FXMLLoader.load(getClass().getResource("/Animals/Cats/retrieveCats/retrieveCats.fxml"));
611 Scene animalsMainMenuScene = new Scene(animalsMainMenuParent);
612 Stage stage = (Stage) ((Node) actionEvent.getSource()).getScene().getWindow();
613 stage.setScene(animalsMainMenuScene);
614 stage.show();
615 }
616
617 public void refreshData(ActionEvent actionEvent) {
618 loadData();
619 }
620}
621
622<?xml version="1.0" encoding="UTF-8"?>
623
624 <?import com.jfoenix.controls.JFXButton?>
625 <?import javafx.geometry.Insets?>
626 <?import javafx.scene.control.ButtonBar?>
627 <?import javafx.scene.control.SplitPane?>
628 <?import javafx.scene.control.TableColumn?>
629 <?import javafx.scene.control.TableView?>
630 <?import javafx.scene.layout.AnchorPane?>
631
632 <AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1" fx:controller="Animals.Cats.retrieveCats.retrieveCatsController">
633 <children>
634 <SplitPane dividerPositions="0.29797979797979796" layoutY="14.0" prefHeight="400.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
635 <items>
636 <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
637 <children>
638 <JFXButton layoutX="62.0" layoutY="93.0" mnemonicParsing="false" onAction="#goToAnimals" text="Animals" />
639 <JFXButton layoutX="62.0" layoutY="118.0" mnemonicParsing="false" onAction="#goToEmployees" text="Employees" />
640 <JFXButton alignment="CENTER" layoutX="62.0" layoutY="143.0" mnemonicParsing="false" onAction="#goToStatus" text="Status" />
641 </children>
642 <padding>
643 <Insets left="10.0" top="20.0" />
644 </padding></AnchorPane>
645 <AnchorPane fx:id="tableRootPane" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
646 <children>
647 <ButtonBar layoutX="138.0" layoutY="345.0" prefHeight="40.0" prefWidth="190.0">
648 <buttons>
649 <JFXButton mnemonicParsing="false" onAction="#editCats" text="Edit" />
650 <JFXButton mnemonicParsing="false" onAction="#deleteSelectedCat" text="Delete" />
651 <!--<JFXButton mnemonicParsing="false" onAction="#goToMainMenuCats" text="Previous" />-->
652 </buttons>
653 </ButtonBar>
654 <TableView fx:id="tableView" prefHeight="345.0" prefWidth="417.0">
655 <columns>
656 <TableColumn fx:id="catsId" prefWidth="75.0" text="ID" />
657 <TableColumn fx:id="catsName" prefWidth="75.0" text="Name" />
658 <TableColumn fx:id="catsRace" prefWidth="75.0" text="Race" />
659 <TableColumn fx:id="catsGender" prefWidth="75.0" text="Gender" />
660 <TableColumn fx:id="catsCoatColor" prefWidth="75.0" text="Coat color" />
661 <TableColumn fx:id="catsAge" prefWidth="75.0" text="Age" />
662 </columns>
663 <columnResizePolicy>
664 <TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
665 </columnResizePolicy>
666 </TableView>
667 </children>
668 </AnchorPane>
669 </items>
670 </SplitPane>
671 </children>
672 </AnchorPane>
673
674
675edit cat fxml
676
677<?xml version="1.0" encoding="UTF-8"?>
678
679<?import com.jfoenix.controls.JFXButton?>
680<?import javafx.scene.control.Button?>
681<?import javafx.scene.control.ButtonBar?>
682<?import javafx.scene.control.TableColumn?>
683<?import javafx.scene.control.TableView?>
684<?import javafx.scene.layout.AnchorPane?>
685
686<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1" fx:controller="Animals.Cats.editCat.editCatController">
687 <children>
688 <TableView fx:id="table" layoutX="129.0" layoutY="14.0" prefHeight="327.0" prefWidth="457.0">
689 <columns>
690 <TableColumn fx:id="idCol" prefWidth="75.0" text="ID" />
691 <TableColumn fx:id="nameCol" onEditCommit="#changeName" prefWidth="75.0" text="Name" />
692 <TableColumn fx:id="raceCol" onEditCommit="#changeRace" prefWidth="75.0" text="Race" />
693 <TableColumn fx:id="genderCol" onEditCommit="#changeGender" prefWidth="75.0" text="Gender" />
694 <TableColumn fx:id="coatColorCol" onEditCommit="#changeCoatColor" prefWidth="75.0" text="Coat color" />
695 <TableColumn fx:id="ageCol" onEditCommit="#changeAge" prefWidth="75.0" text="Age" />
696 </columns>
697 <columnResizePolicy>
698 <TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
699 </columnResizePolicy>
700 </TableView>
701 <ButtonBar layoutX="372.0" layoutY="347.0" prefHeight="40.0" prefWidth="200.0">
702 <buttons>
703 <JFXButton mnemonicParsing="false" onAction="#Save" text="Save" />
704 <JFXButton mnemonicParsing="false" text="Cencel" />
705 <JFXButton mnemonicParsing="false" onAction="#refreshData" text="Refresh" />
706 </buttons>
707 </ButtonBar>
708 <Button layoutX="262.0" layoutY="354.0" mnemonicParsing="false" onAction="#test" text="Button" />
709 </children>
710</AnchorPane>