Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package notepad.controller;
- import javafx.event.ActionEvent;
- import javafx.fxml.FXML;
- import javafx.fxml.FXMLLoader;
- import javafx.fxml.Initializable;
- import javafx.scene.Node;
- import javafx.scene.control.Label;
- import javafx.scene.control.TextArea;
- import javafx.stage.Stage;
- import notepad.model.Notepad;
- import javax.xml.soap.Text;
- import java.io.IOException;
- import java.lang.reflect.InvocationTargetException;
- import java.net.URL;
- import java.util.ResourceBundle;
- /**
- * Created by Krzysztof on 2016-10-25.
- */
- public class MessageController {
- @FXML
- private Label lbl_msg;
- private TextArea textArea;
- private Stage stage;
- private String text;
- private Notepad notepad;
- private NotepadController notepadController;
- public void initialize(Notepad notepad, TextArea textArea, Stage stage){
- this.notepad = notepad;
- this.textArea = textArea;
- this.stage = stage;
- }
- //--------------------setters
- public void setTextArea(TextArea textArea) {
- this.textArea = textArea;
- }
- public void setStage(Stage stage) {
- this.stage = stage;
- }
- public void setText(String text) {
- this.text = text;
- }
- public void handleSaveMsg(ActionEvent event) throws IOException {
- notepad.saveFile(textArea, stage);
- Stage window = (Stage) ((Node) event.getSource()).getScene().getWindow();
- textArea.clear();
- window.close();
- notepad.changeWindowName(stage,"New");
- notepad.setCloseEnabled(true);
- }
- public void handleDontSaveMsg(ActionEvent event) throws IOException{
- Stage window = (Stage) ((Node) event.getSource()).getScene().getWindow();
- textArea.clear();
- window.close();
- notepad.changeWindowName(stage,"New");
- notepad.setCloseEnabled(true);
- }
- public void handleCancelMsg(ActionEvent event) throws IOException {
- notepad.setIsOpenFileNeeded(true);
- Stage window = (Stage) ((Node) event.getSource()).getScene().getWindow();
- window.close();
- notepad.setCloseEnabled(false);
- }
- }
Add Comment
Please, Sign In to add comment