Guest User

FontController

a guest
Nov 14th, 2016
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.61 KB | None | 0 0
  1. package notepad.controller;
  2.  
  3. import javafx.event.ActionEvent;
  4. import javafx.event.Event;
  5. import javafx.fxml.FXML;
  6. import javafx.scene.Node;
  7. import javafx.scene.control.Button;
  8. import javafx.scene.control.ListView;
  9. import javafx.scene.control.TextArea;
  10. import javafx.scene.control.TextField;
  11. import javafx.scene.text.Font;
  12. import javafx.stage.Stage;
  13. import notepad.model.Notepad;
  14.  
  15. /**
  16.  * Created by Krzysztof on 2016-11-09.
  17.  */
  18. public class FontController {
  19.  
  20.     @FXML
  21.     private TextField txtFldSize, txtFldFont, txtFldStyle;
  22.     @FXML
  23.    private ListView lstViewFont, lstViewStyle, lstViewSize;
  24.     @FXML
  25.     private Button btnOK, btnCancel;
  26.  
  27.     private NotepadController notepadController;
  28.     private Notepad notepad;
  29.  
  30.  
  31.  
  32.     //----------------------setter----------
  33.  
  34.     public void setTxtFldSizeText(String text){
  35.         txtFldSize.setText(text);
  36.     }
  37.  
  38.     public void setTxtFldFontText(String text){
  39.         txtFldFont.setText(text);
  40.     }
  41.  
  42.     public void setTxtFldStyleText(String text){
  43.         txtFldStyle.setText(text);
  44.     }
  45.  
  46.     public void setNotepadController(NotepadController notepadController) {
  47.         this.notepadController = notepadController;
  48.     }
  49.  
  50.     public void setLstViewFont(ListView lstViewFont) {
  51.         this.lstViewFont = lstViewFont;
  52.     }
  53.  
  54.     public void setLstViewStyle(ListView lstViewStyle) {
  55.         this.lstViewStyle = lstViewStyle;
  56.     }
  57.  
  58.     public void setLstViewSize(ListView lstViewSize) {
  59.         this.lstViewSize = lstViewSize;
  60.     }
  61.  
  62.     public void setNotepad(Notepad notepad) {
  63.         this.notepad = notepad;
  64.     }
  65.  
  66.  
  67.     //---------------------getters----------
  68.  
  69.  
  70.     public TextField getTxtFldSize() {
  71.         return txtFldSize;
  72.     }
  73.  
  74.     public TextField getTxtFldFont() {
  75.         return txtFldFont;
  76.     }
  77.  
  78.     public TextField getTxtFldStyle() {
  79.         return txtFldStyle;
  80.     }
  81.  
  82.     public ListView getLstViewFont() {
  83.         return lstViewFont;
  84.     }
  85.  
  86.     public ListView getLstViewStyle() {
  87.         return lstViewStyle;
  88.     }
  89.  
  90.     public ListView getLstViewSize() {
  91.         return lstViewSize;
  92.     }
  93.  
  94.  
  95.  
  96.     public void handleOkBtn(ActionEvent event) {
  97.  
  98.         notepad.setChoosenFontOptions();
  99.         Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
  100.         stage.close();
  101.  
  102.     }
  103.  
  104.     public void handleCancelBtn(ActionEvent event) {
  105.         Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
  106.         stage.close();
  107.     }
  108.  
  109.  
  110.     public void handleMouseClicked(Event event) {
  111.         notepad.getFile();
  112.         notepad.displayFontData(event);
  113.     }
  114.  
  115.  
  116. }
Add Comment
Please, Sign In to add comment