123
This commit is contained in:
parent
11243404bd
commit
0b4e9e850e
7
Event oder Filter/.classpath
Normal file
7
Event oder Filter/.classpath
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
1
Event oder Filter/.gitignore
vendored
Normal file
1
Event oder Filter/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/bin/
|
23
Event oder Filter/.project
Normal file
23
Event oder Filter/.project
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Event oder Filter</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
12
Event oder Filter/.settings/org.eclipse.jdt.core.prefs
Normal file
12
Event oder Filter/.settings/org.eclipse.jdt.core.prefs
Normal file
|
@ -0,0 +1,12 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
8
Event oder Filter/build.fxbuild
Normal file
8
Event oder Filter/build.fxbuild
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="ASCII"?>
|
||||
<anttasks:AntTask xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:anttasks="http://org.eclipse.fx.ide.jdt/1.0" buildDirectory="${project}/build">
|
||||
<deploy>
|
||||
<application name="Eventoder Filter"/>
|
||||
<info/>
|
||||
</deploy>
|
||||
<signjar/>
|
||||
</anttasks:AntTask>
|
66
Event oder Filter/src/application/Main.java
Normal file
66
Event oder Filter/src/application/Main.java
Normal file
|
@ -0,0 +1,66 @@
|
|||
package application;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.shape.Circle;
|
||||
|
||||
public class Main extends Application {
|
||||
@Override
|
||||
public void start(Stage primaryStage) {
|
||||
try {
|
||||
|
||||
Circle kreis = new Circle(20);
|
||||
kreis.setFill(Color.BLUE);
|
||||
kreis.setTranslateX(200);
|
||||
kreis.setTranslateY(200);
|
||||
|
||||
Group root = new Group();
|
||||
root.getChildren().add(kreis);
|
||||
|
||||
Scene scene = new Scene(root, 400, 400);
|
||||
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.show();
|
||||
|
||||
EventHandler<MouseEvent> eventHandler1 = new EventHandler<MouseEvent>() {
|
||||
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
kreis.setFill(Color.RED);
|
||||
System.out.println("Filter aufgerufen");
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
EventHandler<MouseEvent> eventHandler2 = new EventHandler<MouseEvent>() {
|
||||
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
kreis.setScaleX(2);
|
||||
kreis.setScaleY(2);
|
||||
System.out.println("Handler aufgerufen");
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
kreis.addEventFilter(MouseEvent.MOUSE_CLICKED, eventHandler1);
|
||||
kreis.addEventHandler(MouseEvent.MOUSE_CLICKED, eventHandler2);
|
||||
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
}
|
1
Event oder Filter/src/application/application.css
Normal file
1
Event oder Filter/src/application/application.css
Normal file
|
@ -0,0 +1 @@
|
|||
/* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */
|
|
@ -1,11 +1,16 @@
|
|||
|
||||
import javafx.application.Application;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
|
@ -35,12 +40,6 @@ public class Login extends Application {
|
|||
loginButton.setTranslateX(80);
|
||||
loginButton.setTranslateY(140);
|
||||
|
||||
//================================================
|
||||
//
|
||||
//================================================
|
||||
|
||||
|
||||
|
||||
Group rootLogin = new Group();
|
||||
|
||||
rootLogin.getChildren().add(loginLabel);
|
||||
|
@ -48,13 +47,96 @@ public class Login extends Application {
|
|||
rootLogin.getChildren().add(eingabePasswort);
|
||||
rootLogin.getChildren().add(loginButton);
|
||||
|
||||
|
||||
Scene loginScene = new Scene(rootLogin, 400, 400);
|
||||
loginScene.setFill(Color.AQUA);
|
||||
primaryStage.setScene(loginScene);
|
||||
primaryStage.show();
|
||||
primaryStage.setTitle("LOGIN");
|
||||
|
||||
// ================================================
|
||||
//
|
||||
// ================================================
|
||||
|
||||
EventHandler<MouseEvent> eventHandler = new EventHandler<MouseEvent>() {
|
||||
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
String name = eingabeBenutzername.getText();
|
||||
String pw = eingabePasswort.getText();
|
||||
|
||||
if (name.equals("marcus") && pw.equals("1234")) {
|
||||
|
||||
Label label1 = new Label("Login erfolgreich");
|
||||
|
||||
Stage stage = new Stage();
|
||||
HBox root = new HBox();
|
||||
root.getChildren().add(label1);
|
||||
|
||||
Scene loginBereich = new Scene(root, 400, 400);
|
||||
|
||||
stage.setScene(loginBereich);
|
||||
stage.show();
|
||||
|
||||
} else {
|
||||
Label label1 = new Label("Login fehlgeschlagen");
|
||||
|
||||
Stage stage = new Stage();
|
||||
HBox root = new HBox();
|
||||
root.getChildren().add(label1);
|
||||
|
||||
Scene loginBereich = new Scene(root, 400, 400);
|
||||
|
||||
stage.setScene(loginBereich);
|
||||
stage.show();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
loginButton.addEventHandler(MouseEvent.MOUSE_CLICKED, eventHandler);
|
||||
|
||||
eingabePasswort.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
||||
|
||||
@Override
|
||||
public void handle(KeyEvent event) {
|
||||
if (event.getCode().equals(KeyCode.ENTER)) {
|
||||
|
||||
String name = eingabeBenutzername.getText();
|
||||
String pw = eingabePasswort.getText();
|
||||
|
||||
if (name.equals("marcus") && pw.equals("1234")) {
|
||||
|
||||
Label label1 = new Label("Login erfolgreich");
|
||||
|
||||
Stage stage = new Stage();
|
||||
HBox root = new HBox();
|
||||
root.getChildren().add(label1);
|
||||
|
||||
Scene loginBereich = new Scene(root, 400, 400);
|
||||
stage.setScene(loginBereich);
|
||||
stage.show();
|
||||
|
||||
} else {
|
||||
Label label1 = new Label("Login fehlgeschlagen");
|
||||
|
||||
Stage stage = new Stage();
|
||||
HBox root = new HBox();
|
||||
root.getChildren().add(label1);
|
||||
|
||||
Scene loginBereich = new Scene(root, 400, 400);
|
||||
|
||||
stage.setScene(loginBereich);
|
||||
stage.show();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user