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.scene.Parent;
- import javafx.scene.Scene;
- import javafx.scene.control.MenuBar;
- import javafx.scene.control.TextArea;
- import javafx.scene.text.Font;
- import javafx.stage.Stage;
- import notepad.model.Notepad;
- import java.io.IOException;
- /**
- * Created by Krzysztof on 2016-10-25.
- */
- public class NotepadController{
- @FXML
- private MenuBar menubar;
- @FXML
- private TextArea text_area;
- private Stage stage;
- private Notepad notepad;
- public void initialize(Stage stage) throws IOException {
- this.notepad = new Notepad();
- this.stage = stage;
- notepad.initialize(this);
- }
- //---------------------getters------------
- public TextArea getText_area() {
- return text_area;
- }
- public Stage getStage() {
- return stage;
- }
- public Notepad getNotepad() {
- return notepad;
- }
- //--------------------setters----------------
- public void setTextAreaContent(String content) {
- text_area.setText(content);
- }
- public void setText_area(TextArea text_area) {
- this.text_area = text_area;
- }
- public void handleItemSaveAs(ActionEvent event) {
- notepad.saveFileAs(text_area,stage);
- }
- public void handleItemOpen(ActionEvent event) throws IOException {
- text_area.setText(notepad.openFile(text_area, stage));
- }
- public void handleItemNew(ActionEvent event) throws IOException {
- notepad.newFile(text_area, stage);
- }
- public void handleItemSave(ActionEvent event) throws IOException {
- notepad.saveFile(text_area,stage);
- }
- public void test(){
- }
- public void handleItemWordWrap(ActionEvent event) {
- if (!text_area.isWrapText()){
- text_area.setWrapText(true);
- }
- else{
- text_area.setWrapText(false);
- }
- }
- public void handleItemFont(ActionEvent event) throws IOException {
- notepad.loadFontWindow();
- }
- public void handleIteamClear(ActionEvent event) {
- text_area.clear();
- }
- }
Add Comment
Please, Sign In to add comment