Add Texteditor
This commit is contained in:
parent
e7eff3b0cd
commit
4d530d7e0a
@ -1,4 +1,4 @@
|
|||||||
#Fri, 09 Aug 2019 06:43:38 +0200
|
#Fri, 09 Aug 2019 06:54:47 +0200
|
||||||
|
|
||||||
|
|
||||||
D\:\\Git-Repos\\java-fx-8-samples=
|
D\:\\Git-Repos\\java-fx-8-samples=
|
||||||
|
16
build/classes/texteditor/About.fxml
Normal file
16
build/classes/texteditor/About.fxml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import java.util.*?>
|
||||||
|
<?import javafx.scene.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
|
<AnchorPane id="AnchorPane" prefHeight="79.0" prefWidth="247.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="texteditor.AboutController">
|
||||||
|
<children>
|
||||||
|
<Label fx:id="lblTest" alignment="CENTER" layoutX="32.0" layoutY="14.0" text="Ein Programm von Marcel Schwarz" />
|
||||||
|
<Button fx:id="btnButton" layoutX="172.0" layoutY="42.0" mnemonicParsing="false" onAction="#handleButton" text="Schließen" />
|
||||||
|
<Button fx:id="btnWeb" layoutX="14.0" layoutY="42.0" mnemonicParsing="false" onAction="#handleWeb" text="icaotix.de" />
|
||||||
|
<Label fx:id="lblCopied" layoutX="34.0" layoutY="-109.0" text="Copied to Clipboard" />
|
||||||
|
</children>
|
||||||
|
</AnchorPane>
|
BIN
build/classes/texteditor/AboutController.class
Normal file
BIN
build/classes/texteditor/AboutController.class
Normal file
Binary file not shown.
83
build/classes/texteditor/FXMLDocument.fxml
Normal file
83
build/classes/texteditor/FXMLDocument.fxml
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.geometry.*?>
|
||||||
|
<?import javafx.scene.input.*?>
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import java.util.*?>
|
||||||
|
<?import javafx.scene.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
|
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="399.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="texteditor.FXMLDocumentController">
|
||||||
|
<top>
|
||||||
|
<MenuBar BorderPane.alignment="CENTER">
|
||||||
|
<menus>
|
||||||
|
<Menu text="File">
|
||||||
|
<items>
|
||||||
|
<MenuItem fx:id="MOpen" onAction="#handleMOpen" text="Open ">
|
||||||
|
<accelerator>
|
||||||
|
<KeyCodeCombination alt="UP" code="O" control="ANY" meta="UP" shift="UP" shortcut="UP" />
|
||||||
|
</accelerator></MenuItem>
|
||||||
|
<MenuItem fx:id="MSave" onAction="#handleMSave" text="Save">
|
||||||
|
<accelerator>
|
||||||
|
<KeyCodeCombination alt="UP" code="S" control="ANY" meta="UP" shift="UP" shortcut="UP" />
|
||||||
|
</accelerator></MenuItem>
|
||||||
|
<SeparatorMenuItem mnemonicParsing="false" />
|
||||||
|
<MenuItem fx:id="MQuit" onAction="#handleMQuit" text="Quit ">
|
||||||
|
<accelerator>
|
||||||
|
<KeyCodeCombination alt="UP" code="Q" control="ANY" meta="UP" shift="UP" shortcut="UP" />
|
||||||
|
</accelerator></MenuItem>
|
||||||
|
</items>
|
||||||
|
</Menu>
|
||||||
|
<Menu text="Edit">
|
||||||
|
<items>
|
||||||
|
<MenuItem fx:id="MCopy" onAction="#handleMCopy" text="Copy">
|
||||||
|
<accelerator>
|
||||||
|
<KeyCodeCombination alt="UP" code="C" control="ANY" meta="UP" shift="UP" shortcut="UP" />
|
||||||
|
</accelerator>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem fx:id="MPaste" onAction="#handleMPaste" text="Paste">
|
||||||
|
<accelerator>
|
||||||
|
<KeyCodeCombination alt="UP" code="V" control="ANY" meta="UP" shift="UP" shortcut="UP" />
|
||||||
|
</accelerator>
|
||||||
|
</MenuItem>
|
||||||
|
<SeparatorMenuItem mnemonicParsing="false" />
|
||||||
|
<MenuItem fx:id="MRefresh" onAction="#handleMRefrash" text="Refresh">
|
||||||
|
<accelerator>
|
||||||
|
<KeyCodeCombination alt="UP" code="R" control="ANY" meta="UP" shift="UP" shortcut="UP" />
|
||||||
|
</accelerator></MenuItem>
|
||||||
|
<SeparatorMenuItem mnemonicParsing="false" />
|
||||||
|
<MenuItem fx:id="MClose" onAction="#handleMClose" text="Close">
|
||||||
|
<accelerator>
|
||||||
|
<KeyCodeCombination alt="ANY" code="C" control="UP" meta="UP" shift="UP" shortcut="UP" />
|
||||||
|
</accelerator></MenuItem>
|
||||||
|
</items>
|
||||||
|
</Menu>
|
||||||
|
<Menu text="Help">
|
||||||
|
<items>
|
||||||
|
<MenuItem fx:id="MAbout" onAction="#handleMAbout" text="About" />
|
||||||
|
</items>
|
||||||
|
</Menu>
|
||||||
|
</menus>
|
||||||
|
</MenuBar>
|
||||||
|
</top>
|
||||||
|
<center>
|
||||||
|
<TextArea fx:id="TextArea" prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
|
||||||
|
<contextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<items>
|
||||||
|
<MenuItem fx:id="CMCopy" mnemonicParsing="false" onAction="#handleMCopy" text="Copy" />
|
||||||
|
<MenuItem fx:id="CMPaste" mnemonicParsing="false" onAction="#handleMPaste" text="Paste" />
|
||||||
|
<MenuItem fx:id="CMRefresh" mnemonicParsing="false" onAction="#handleMRefrash" text="Refresh" />
|
||||||
|
</items>
|
||||||
|
</ContextMenu>
|
||||||
|
</contextMenu></TextArea>
|
||||||
|
</center>
|
||||||
|
<bottom>
|
||||||
|
<HBox prefHeight="2.0" prefWidth="600.0" BorderPane.alignment="CENTER">
|
||||||
|
<children>
|
||||||
|
<Label alignment="CENTER" prefHeight="47.0" prefWidth="600.0" text="© Copyright 2015 Schwarz" />
|
||||||
|
</children>
|
||||||
|
</HBox>
|
||||||
|
</bottom>
|
||||||
|
</BorderPane>
|
BIN
build/classes/texteditor/FXMLDocumentController.class
Normal file
BIN
build/classes/texteditor/FXMLDocumentController.class
Normal file
Binary file not shown.
BIN
build/classes/texteditor/Main.class
Normal file
BIN
build/classes/texteditor/Main.class
Normal file
Binary file not shown.
BIN
build/classes/texteditor/MainAbout.class
Normal file
BIN
build/classes/texteditor/MainAbout.class
Normal file
Binary file not shown.
BIN
build/classes/texteditor/icon.png
Normal file
BIN
build/classes/texteditor/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 356 B |
BIN
build/classes/texteditor/icon2.png
Normal file
BIN
build/classes/texteditor/icon2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 40 KiB |
Binary file not shown.
4
dist/java-fx-8-samples.html
vendored
4
dist/java-fx-8-samples.html
vendored
@ -4,7 +4,7 @@
|
|||||||
function launchApplication(jnlpfile) {
|
function launchApplication(jnlpfile) {
|
||||||
dtjava.launch( {
|
dtjava.launch( {
|
||||||
url : 'java-fx-8-samples.jnlp',
|
url : 'java-fx-8-samples.jnlp',
|
||||||
jnlp_content : 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxqbmxwIHNwZWM9IjEuMCIgeG1sbnM6amZ4PSJodHRwOi8vamF2YWZ4LmNvbSIgaHJlZj0iamF2YS1meC04LXNhbXBsZXMuam5scCI+DQogIDxpbmZvcm1hdGlvbj4NCiAgICA8dGl0bGU+amF2YS1meC04LXNhbXBsZXM8L3RpdGxlPg0KICAgIDx2ZW5kb3I+bXNjaHc8L3ZlbmRvcj4NCiAgICA8ZGVzY3JpcHRpb24+bnVsbDwvZGVzY3JpcHRpb24+DQogICAgPG9mZmxpbmUtYWxsb3dlZC8+DQogIDwvaW5mb3JtYXRpb24+DQogIDxyZXNvdXJjZXM+DQogICAgPGoyc2UgdmVyc2lvbj0iMS42KyIgaHJlZj0iaHR0cDovL2phdmEuc3VuLmNvbS9wcm9kdWN0cy9hdXRvZGwvajJzZSIvPg0KICAgIDxqYXIgaHJlZj0iamF2YS1meC04LXNhbXBsZXMuamFyIiBzaXplPSIyMTk2MjYiIGRvd25sb2FkPSJlYWdlciIgLz4NCiAgPC9yZXNvdXJjZXM+DQogIDxqZng6amF2YWZ4LWRlc2MgIHdpZHRoPSI4MDAiIGhlaWdodD0iNjAwIiBtYWluLWNsYXNzPSJ1dGlscy5SdW5uZXIiICBuYW1lPSJqYXZhLWZ4LTgtc2FtcGxlcyIgLz4NCiAgPHVwZGF0ZSBjaGVjaz0iYWx3YXlzIi8+DQo8L2pubHA+DQo='
|
jnlp_content : 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxqbmxwIHNwZWM9IjEuMCIgeG1sbnM6amZ4PSJodHRwOi8vamF2YWZ4LmNvbSIgaHJlZj0iamF2YS1meC04LXNhbXBsZXMuam5scCI+DQogIDxpbmZvcm1hdGlvbj4NCiAgICA8dGl0bGU+amF2YS1meC04LXNhbXBsZXM8L3RpdGxlPg0KICAgIDx2ZW5kb3I+bXNjaHc8L3ZlbmRvcj4NCiAgICA8ZGVzY3JpcHRpb24+bnVsbDwvZGVzY3JpcHRpb24+DQogICAgPG9mZmxpbmUtYWxsb3dlZC8+DQogIDwvaW5mb3JtYXRpb24+DQogIDxyZXNvdXJjZXM+DQogICAgPGoyc2UgdmVyc2lvbj0iMS42KyIgaHJlZj0iaHR0cDovL2phdmEuc3VuLmNvbS9wcm9kdWN0cy9hdXRvZGwvajJzZSIvPg0KICAgIDxqYXIgaHJlZj0iamF2YS1meC04LXNhbXBsZXMuamFyIiBzaXplPSIyNjQwNzMiIGRvd25sb2FkPSJlYWdlciIgLz4NCiAgPC9yZXNvdXJjZXM+DQogIDxqZng6amF2YWZ4LWRlc2MgIHdpZHRoPSI4MDAiIGhlaWdodD0iNjAwIiBtYWluLWNsYXNzPSJ1dGlscy5SdW5uZXIiICBuYW1lPSJqYXZhLWZ4LTgtc2FtcGxlcyIgLz4NCiAgPHVwZGF0ZSBjaGVjaz0iYWx3YXlzIi8+DQo8L2pubHA+DQo='
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
javafx : '8.0+'
|
javafx : '8.0+'
|
||||||
@ -24,7 +24,7 @@
|
|||||||
placeholder : 'javafx-app-placeholder',
|
placeholder : 'javafx-app-placeholder',
|
||||||
width : '800',
|
width : '800',
|
||||||
height : '600',
|
height : '600',
|
||||||
jnlp_content : 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxqbmxwIHNwZWM9IjEuMCIgeG1sbnM6amZ4PSJodHRwOi8vamF2YWZ4LmNvbSIgaHJlZj0iamF2YS1meC04LXNhbXBsZXMuam5scCI+DQogIDxpbmZvcm1hdGlvbj4NCiAgICA8dGl0bGU+amF2YS1meC04LXNhbXBsZXM8L3RpdGxlPg0KICAgIDx2ZW5kb3I+bXNjaHc8L3ZlbmRvcj4NCiAgICA8ZGVzY3JpcHRpb24+bnVsbDwvZGVzY3JpcHRpb24+DQogICAgPG9mZmxpbmUtYWxsb3dlZC8+DQogIDwvaW5mb3JtYXRpb24+DQogIDxyZXNvdXJjZXM+DQogICAgPGoyc2UgdmVyc2lvbj0iMS42KyIgaHJlZj0iaHR0cDovL2phdmEuc3VuLmNvbS9wcm9kdWN0cy9hdXRvZGwvajJzZSIvPg0KICAgIDxqYXIgaHJlZj0iamF2YS1meC04LXNhbXBsZXMuamFyIiBzaXplPSIyMTk2MjYiIGRvd25sb2FkPSJlYWdlciIgLz4NCiAgPC9yZXNvdXJjZXM+DQogIDxqZng6amF2YWZ4LWRlc2MgIHdpZHRoPSI4MDAiIGhlaWdodD0iNjAwIiBtYWluLWNsYXNzPSJ1dGlscy5SdW5uZXIiICBuYW1lPSJqYXZhLWZ4LTgtc2FtcGxlcyIgLz4NCiAgPHVwZGF0ZSBjaGVjaz0iYWx3YXlzIi8+DQo8L2pubHA+DQo='
|
jnlp_content : 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxqbmxwIHNwZWM9IjEuMCIgeG1sbnM6amZ4PSJodHRwOi8vamF2YWZ4LmNvbSIgaHJlZj0iamF2YS1meC04LXNhbXBsZXMuam5scCI+DQogIDxpbmZvcm1hdGlvbj4NCiAgICA8dGl0bGU+amF2YS1meC04LXNhbXBsZXM8L3RpdGxlPg0KICAgIDx2ZW5kb3I+bXNjaHc8L3ZlbmRvcj4NCiAgICA8ZGVzY3JpcHRpb24+bnVsbDwvZGVzY3JpcHRpb24+DQogICAgPG9mZmxpbmUtYWxsb3dlZC8+DQogIDwvaW5mb3JtYXRpb24+DQogIDxyZXNvdXJjZXM+DQogICAgPGoyc2UgdmVyc2lvbj0iMS42KyIgaHJlZj0iaHR0cDovL2phdmEuc3VuLmNvbS9wcm9kdWN0cy9hdXRvZGwvajJzZSIvPg0KICAgIDxqYXIgaHJlZj0iamF2YS1meC04LXNhbXBsZXMuamFyIiBzaXplPSIyNjQwNzMiIGRvd25sb2FkPSJlYWdlciIgLz4NCiAgPC9yZXNvdXJjZXM+DQogIDxqZng6amF2YWZ4LWRlc2MgIHdpZHRoPSI4MDAiIGhlaWdodD0iNjAwIiBtYWluLWNsYXNzPSJ1dGlscy5SdW5uZXIiICBuYW1lPSJqYXZhLWZ4LTgtc2FtcGxlcyIgLz4NCiAgPHVwZGF0ZSBjaGVjaz0iYWx3YXlzIi8+DQo8L2pubHA+DQo='
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
javafx : '8.0+'
|
javafx : '8.0+'
|
||||||
|
BIN
dist/java-fx-8-samples.jar
vendored
BIN
dist/java-fx-8-samples.jar
vendored
Binary file not shown.
2
dist/java-fx-8-samples.jnlp
vendored
2
dist/java-fx-8-samples.jnlp
vendored
@ -8,7 +8,7 @@
|
|||||||
</information>
|
</information>
|
||||||
<resources>
|
<resources>
|
||||||
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
|
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
|
||||||
<jar href="java-fx-8-samples.jar" size="219626" download="eager" />
|
<jar href="java-fx-8-samples.jar" size="264073" download="eager" />
|
||||||
</resources>
|
</resources>
|
||||||
<jfx:javafx-desc width="800" height="600" main-class="utils.Runner" name="java-fx-8-samples" />
|
<jfx:javafx-desc width="800" height="600" main-class="utils.Runner" name="java-fx-8-samples" />
|
||||||
<update check="always"/>
|
<update check="always"/>
|
||||||
|
16
src/texteditor/About.fxml
Normal file
16
src/texteditor/About.fxml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import java.util.*?>
|
||||||
|
<?import javafx.scene.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
|
<AnchorPane id="AnchorPane" prefHeight="79.0" prefWidth="247.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="texteditor.AboutController">
|
||||||
|
<children>
|
||||||
|
<Label fx:id="lblTest" alignment="CENTER" layoutX="32.0" layoutY="14.0" text="Ein Programm von Marcel Schwarz" />
|
||||||
|
<Button fx:id="btnButton" layoutX="172.0" layoutY="42.0" mnemonicParsing="false" onAction="#handleButton" text="Schließen" />
|
||||||
|
<Button fx:id="btnWeb" layoutX="14.0" layoutY="42.0" mnemonicParsing="false" onAction="#handleWeb" text="icaotix.de" />
|
||||||
|
<Label fx:id="lblCopied" layoutX="34.0" layoutY="-109.0" text="Copied to Clipboard" />
|
||||||
|
</children>
|
||||||
|
</AnchorPane>
|
59
src/texteditor/AboutController.java
Normal file
59
src/texteditor/AboutController.java
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package texteditor;
|
||||||
|
|
||||||
|
import java.awt.Toolkit;
|
||||||
|
import java.awt.datatransfer.StringSelection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.fxml.Initializable;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FXML Controller class
|
||||||
|
*
|
||||||
|
* @author Marcel
|
||||||
|
*/
|
||||||
|
public class AboutController implements Initializable {
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Label lblTest;
|
||||||
|
@FXML
|
||||||
|
private Button btnButton;
|
||||||
|
@FXML
|
||||||
|
private Button btnWeb;
|
||||||
|
@FXML
|
||||||
|
private Label lblCopied;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the controller class.
|
||||||
|
* @param url
|
||||||
|
* @param rb
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void initialize(URL url, ResourceBundle rb) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void handleButton(ActionEvent event) throws Exception {
|
||||||
|
texteditor.FXMLDocumentController.destroyAbout();
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void handleWeb(ActionEvent event) throws InterruptedException {
|
||||||
|
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection("http://icaotix.de"), null);
|
||||||
|
|
||||||
|
btnWeb.setLayoutX(34.0);
|
||||||
|
btnWeb.setLayoutY(-109.0);
|
||||||
|
|
||||||
|
lblCopied.setLayoutX(14.0);
|
||||||
|
lblCopied.setLayoutY(46.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
83
src/texteditor/FXMLDocument.fxml
Normal file
83
src/texteditor/FXMLDocument.fxml
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.geometry.*?>
|
||||||
|
<?import javafx.scene.input.*?>
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import java.util.*?>
|
||||||
|
<?import javafx.scene.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
|
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="399.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="texteditor.FXMLDocumentController">
|
||||||
|
<top>
|
||||||
|
<MenuBar BorderPane.alignment="CENTER">
|
||||||
|
<menus>
|
||||||
|
<Menu text="File">
|
||||||
|
<items>
|
||||||
|
<MenuItem fx:id="MOpen" onAction="#handleMOpen" text="Open ">
|
||||||
|
<accelerator>
|
||||||
|
<KeyCodeCombination alt="UP" code="O" control="ANY" meta="UP" shift="UP" shortcut="UP" />
|
||||||
|
</accelerator></MenuItem>
|
||||||
|
<MenuItem fx:id="MSave" onAction="#handleMSave" text="Save">
|
||||||
|
<accelerator>
|
||||||
|
<KeyCodeCombination alt="UP" code="S" control="ANY" meta="UP" shift="UP" shortcut="UP" />
|
||||||
|
</accelerator></MenuItem>
|
||||||
|
<SeparatorMenuItem mnemonicParsing="false" />
|
||||||
|
<MenuItem fx:id="MQuit" onAction="#handleMQuit" text="Quit ">
|
||||||
|
<accelerator>
|
||||||
|
<KeyCodeCombination alt="UP" code="Q" control="ANY" meta="UP" shift="UP" shortcut="UP" />
|
||||||
|
</accelerator></MenuItem>
|
||||||
|
</items>
|
||||||
|
</Menu>
|
||||||
|
<Menu text="Edit">
|
||||||
|
<items>
|
||||||
|
<MenuItem fx:id="MCopy" onAction="#handleMCopy" text="Copy">
|
||||||
|
<accelerator>
|
||||||
|
<KeyCodeCombination alt="UP" code="C" control="ANY" meta="UP" shift="UP" shortcut="UP" />
|
||||||
|
</accelerator>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem fx:id="MPaste" onAction="#handleMPaste" text="Paste">
|
||||||
|
<accelerator>
|
||||||
|
<KeyCodeCombination alt="UP" code="V" control="ANY" meta="UP" shift="UP" shortcut="UP" />
|
||||||
|
</accelerator>
|
||||||
|
</MenuItem>
|
||||||
|
<SeparatorMenuItem mnemonicParsing="false" />
|
||||||
|
<MenuItem fx:id="MRefresh" onAction="#handleMRefrash" text="Refresh">
|
||||||
|
<accelerator>
|
||||||
|
<KeyCodeCombination alt="UP" code="R" control="ANY" meta="UP" shift="UP" shortcut="UP" />
|
||||||
|
</accelerator></MenuItem>
|
||||||
|
<SeparatorMenuItem mnemonicParsing="false" />
|
||||||
|
<MenuItem fx:id="MClose" onAction="#handleMClose" text="Close">
|
||||||
|
<accelerator>
|
||||||
|
<KeyCodeCombination alt="ANY" code="C" control="UP" meta="UP" shift="UP" shortcut="UP" />
|
||||||
|
</accelerator></MenuItem>
|
||||||
|
</items>
|
||||||
|
</Menu>
|
||||||
|
<Menu text="Help">
|
||||||
|
<items>
|
||||||
|
<MenuItem fx:id="MAbout" onAction="#handleMAbout" text="About" />
|
||||||
|
</items>
|
||||||
|
</Menu>
|
||||||
|
</menus>
|
||||||
|
</MenuBar>
|
||||||
|
</top>
|
||||||
|
<center>
|
||||||
|
<TextArea fx:id="TextArea" prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
|
||||||
|
<contextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<items>
|
||||||
|
<MenuItem fx:id="CMCopy" mnemonicParsing="false" onAction="#handleMCopy" text="Copy" />
|
||||||
|
<MenuItem fx:id="CMPaste" mnemonicParsing="false" onAction="#handleMPaste" text="Paste" />
|
||||||
|
<MenuItem fx:id="CMRefresh" mnemonicParsing="false" onAction="#handleMRefrash" text="Refresh" />
|
||||||
|
</items>
|
||||||
|
</ContextMenu>
|
||||||
|
</contextMenu></TextArea>
|
||||||
|
</center>
|
||||||
|
<bottom>
|
||||||
|
<HBox prefHeight="2.0" prefWidth="600.0" BorderPane.alignment="CENTER">
|
||||||
|
<children>
|
||||||
|
<Label alignment="CENTER" prefHeight="47.0" prefWidth="600.0" text="© Copyright 2015 Schwarz" />
|
||||||
|
</children>
|
||||||
|
</HBox>
|
||||||
|
</bottom>
|
||||||
|
</BorderPane>
|
172
src/texteditor/FXMLDocumentController.java
Normal file
172
src/texteditor/FXMLDocumentController.java
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package texteditor;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.fxml.Initializable;
|
||||||
|
import javafx.scene.control.MenuItem;
|
||||||
|
import javafx.scene.control.TextArea;
|
||||||
|
import javafx.scene.input.Clipboard;
|
||||||
|
import javafx.scene.input.ClipboardContent;
|
||||||
|
import javafx.stage.FileChooser;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Marcel
|
||||||
|
*/
|
||||||
|
public class FXMLDocumentController implements Initializable {
|
||||||
|
|
||||||
|
//Stages
|
||||||
|
private final Stage stage = new Stage();
|
||||||
|
private static Stage stage2 = new Stage();
|
||||||
|
|
||||||
|
//Dateien
|
||||||
|
private final FileChooser fc = new FileChooser();
|
||||||
|
private File f;
|
||||||
|
private FileReader fr;
|
||||||
|
private final String zeilenumbruch;
|
||||||
|
|
||||||
|
//Copy and Paste
|
||||||
|
private String selected;
|
||||||
|
private static final texteditor.MainAbout ad = new MainAbout();
|
||||||
|
Clipboard clipboard = Clipboard.getSystemClipboard();
|
||||||
|
ClipboardContent content = new ClipboardContent();
|
||||||
|
|
||||||
|
//Oberflaeche
|
||||||
|
@FXML
|
||||||
|
private MenuItem MOpen;
|
||||||
|
@FXML
|
||||||
|
private MenuItem MQuit;
|
||||||
|
@FXML
|
||||||
|
private MenuItem MRefresh;
|
||||||
|
@FXML
|
||||||
|
private MenuItem MClose;
|
||||||
|
@FXML
|
||||||
|
private MenuItem MAbout;
|
||||||
|
@FXML
|
||||||
|
private TextArea TextArea;
|
||||||
|
@FXML
|
||||||
|
private MenuItem MSave;
|
||||||
|
@FXML
|
||||||
|
private MenuItem MCopy;
|
||||||
|
@FXML
|
||||||
|
private MenuItem MPaste;
|
||||||
|
@FXML
|
||||||
|
private MenuItem CMCopy;
|
||||||
|
@FXML
|
||||||
|
private MenuItem CMPaste;
|
||||||
|
@FXML
|
||||||
|
private MenuItem CMRefresh;
|
||||||
|
|
||||||
|
public FXMLDocumentController() {
|
||||||
|
this.zeilenumbruch = System.getProperty("line.separator");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize(URL url, ResourceBundle rb) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void handleMOpen(ActionEvent event) throws IOException {
|
||||||
|
fc.setTitle("Coose txt File");
|
||||||
|
fc.getExtensionFilters().add(new FileChooser.ExtensionFilter("TXT", "*.txt"));
|
||||||
|
f = fc.showOpenDialog(stage);
|
||||||
|
fc.getExtensionFilters().clear();
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void handleMQuit(ActionEvent event) {
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void handleMRefrash(ActionEvent event) throws IOException {
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void handleMClose(ActionEvent event) {
|
||||||
|
TextArea.setText("");
|
||||||
|
f = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void handleMAbout(ActionEvent event) throws Exception {
|
||||||
|
ad.start(stage2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void handleMSave(ActionEvent event) throws IOException {
|
||||||
|
if (f != null) {
|
||||||
|
FileWriter fw = new FileWriter(f);
|
||||||
|
try (BufferedWriter bw = new BufferedWriter(fw)) {
|
||||||
|
String writeTXT = TextArea.getText();
|
||||||
|
writeTXT = writeTXT.replaceAll("\n", zeilenumbruch);
|
||||||
|
bw.write(writeTXT);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fc.setTitle("Save at");
|
||||||
|
fc.getExtensionFilters().add(new FileChooser.ExtensionFilter("TXT", "*.txt"));
|
||||||
|
f = fc.showSaveDialog(stage);
|
||||||
|
fc.getExtensionFilters().clear();
|
||||||
|
//handleMSave(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refresh() throws FileNotFoundException, IOException {
|
||||||
|
TextArea.setText("");
|
||||||
|
if (f != null) {
|
||||||
|
fr = new FileReader(f);
|
||||||
|
try (BufferedReader br = new BufferedReader(fr)) {
|
||||||
|
String zeile;
|
||||||
|
while ((zeile = br.readLine()) != null) {
|
||||||
|
TextArea.appendText(zeile);
|
||||||
|
TextArea.appendText("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void destroyAbout() {
|
||||||
|
stage2.close();
|
||||||
|
stage2 = new Stage();
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void handleMCopy(ActionEvent event) {
|
||||||
|
selected = TextArea.getSelectedText();
|
||||||
|
content.putString(selected);
|
||||||
|
clipboard.clear();
|
||||||
|
clipboard.setContent(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void handleMPaste(ActionEvent event) {
|
||||||
|
if (clipboard.hasString()) {
|
||||||
|
int cursor = TextArea.getCaretPosition();
|
||||||
|
String curText = TextArea.getText();
|
||||||
|
String paste1 = curText.substring(0, cursor);
|
||||||
|
String paste2 = curText.substring(cursor, curText.length());
|
||||||
|
curText = paste1 + clipboard.getString() + paste2;
|
||||||
|
TextArea.setText(curText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
47
src/texteditor/Main.java
Normal file
47
src/texteditor/Main.java
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package texteditor;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
import javafx.application.Application;
|
||||||
|
import static javafx.application.Application.launch;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.scene.Parent;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Marcel
|
||||||
|
*/
|
||||||
|
public class Main extends Application {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(Stage stage) {
|
||||||
|
Parent root = null;
|
||||||
|
try {
|
||||||
|
root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
|
||||||
|
} catch (IOException ex) {
|
||||||
|
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
Scene scene = new Scene(root);
|
||||||
|
stage.getIcons().add(new javafx.scene.image.Image("/texteditor/icon2.png"));
|
||||||
|
stage.setTitle("TXT-Editor");
|
||||||
|
stage.setScene(scene);
|
||||||
|
stage.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param args the command line arguments
|
||||||
|
*/
|
||||||
|
public static void main(String[] args) {
|
||||||
|
launch(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
45
src/texteditor/MainAbout.java
Normal file
45
src/texteditor/MainAbout.java
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package texteditor;
|
||||||
|
|
||||||
|
import javafx.application.Application;
|
||||||
|
import static javafx.application.Application.launch;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.scene.Parent;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.stage.Modality;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import javafx.stage.WindowEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Marcel
|
||||||
|
*/
|
||||||
|
public class MainAbout extends Application {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(Stage stage) throws Exception {
|
||||||
|
Parent root = FXMLLoader.load(getClass().getResource("About.fxml"));
|
||||||
|
|
||||||
|
Scene scene = new Scene(root);
|
||||||
|
stage.initModality(Modality.APPLICATION_MODAL);
|
||||||
|
stage.setAlwaysOnTop(true);
|
||||||
|
stage.setOnCloseRequest((event) -> texteditor.FXMLDocumentController.destroyAbout());
|
||||||
|
|
||||||
|
stage.getIcons().add(new javafx.scene.image.Image("/texteditor/icon2.png"));
|
||||||
|
stage.setResizable(false);
|
||||||
|
stage.setTitle("About Me");
|
||||||
|
stage.setScene(scene);
|
||||||
|
stage.showAndWait();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param args the command line arguments
|
||||||
|
*/
|
||||||
|
public static void main(String[] args) {
|
||||||
|
launch(args);
|
||||||
|
}
|
||||||
|
}
|
BIN
src/texteditor/icon.png
Normal file
BIN
src/texteditor/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 356 B |
BIN
src/texteditor/icon2.png
Normal file
BIN
src/texteditor/icon2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 40 KiB |
@ -5,18 +5,13 @@
|
|||||||
*/
|
*/
|
||||||
package utils;
|
package utils;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.event.EventHandler;
|
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.ScrollPane;
|
import javafx.scene.control.ScrollPane;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
import javafx.scene.layout.StackPane;
|
|
||||||
import javafx.scene.text.Font;
|
import javafx.scene.text.Font;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
@ -152,6 +147,10 @@ public class Runner extends Application{
|
|||||||
btn26.setOnAction(event -> new steganography.Main().start(new Stage()));
|
btn26.setOnAction(event -> new steganography.Main().start(new Stage()));
|
||||||
gridpane.add(btn26, 1, 10);
|
gridpane.add(btn26, 1, 10);
|
||||||
|
|
||||||
|
Button btn27 = new Button("Start Texteditor");
|
||||||
|
btn27.setOnAction(event -> new texteditor.Main().start(new Stage()));
|
||||||
|
gridpane.add(btn27, 2, 10);
|
||||||
|
|
||||||
|
|
||||||
ScrollPane root = new ScrollPane(gridpane);
|
ScrollPane root = new ScrollPane(gridpane);
|
||||||
Scene scene = new Scene(root, 600, 400);
|
Scene scene = new Scene(root, 600, 400);
|
||||||
|
Loading…
Reference in New Issue
Block a user