Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public void start(Stage primaryStage) {
cb.getItems().add(new Person("Jérôme", "Boateng", 25));
cb.getItems().add(new Person("Benedikt", "Höwedes", 26));
//...

cb.setConverter(new StringConverter<Person>() {
@Override
public String toString(Person p) {
Expand All @@ -31,9 +32,7 @@ public String toString(Person p) {
@Override
public Person fromString(String string) {
// muss für diesen Anwendungsfall nicht implementiert sein
throw new UnsupportedOperationException("Not"
+ "supported yet."
);
throw new UnsupportedOperationException("Not supported yet.");
}
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
/*
* 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 de.javafxbuch;

public class Person {
String lastName;
String firstName;
int age;
public Person(String firstName, String lastName, int age) {
this.lastName = lastName;
this.firstName = firstName;
this.age = age;
}
public String getLastName() {
return lastName;
}
public String getFirstName() {
return firstName;
}
public int getAge() {
return age;
} }
String lastName;
String firstName;
int age;

public Person(String firstName, String lastName, int age) {
this.lastName = lastName;
this.firstName = firstName;
this.age = age;
}

public String getLastName() {
return lastName;
}

public String getFirstName() {
return firstName;
}

public int getAge() {
return age;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ public static void main(String[] args) throws Exception {
launch(args);
}

@Override
public void start(Stage primaryStage) {
ColorPicker colorPicker = new ColorPicker(); colorPicker.setOnAction( e -> System.out.println( "Farbe "
+colorPicker.getValue()));
StackPane pane = new StackPane(colorPicker);
Scene scene = new Scene(pane, 300, 250);
@Override
public void start(Stage primaryStage) {
ColorPicker colorPicker = new ColorPicker();
colorPicker.setOnAction(e -> System.out.println("Farbe " + colorPicker.getValue()));
StackPane pane = new StackPane(colorPicker);
Scene scene = new Scene(pane, 300, 250);

primaryStage.setScene(scene);
primaryStage.setScene(scene);

primaryStage.show();
primaryStage.show();
}

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ public static void main(String[] args) throws Exception {
@Override
public void start(Stage primaryStage) {
ComboBox<Person> cb = new ComboBox<>();
cb.getItems().add(new Person("Manuel", "Neuer", 28));
Person neuer = new Person("Manuel", "Neuer", 28);
cb.getItems().add(neuer);
cb.getItems().add(new Person("Philipp", "Lahm", 30));
cb.getItems().add(new Person("Mats", "Hummels", 25));
cb.getItems().add(new Person("Jérôme", "Boateng", 25));
cb.getItems().add(new Person("Benedikt", "Höwedes", 26));
cb.setValue(neuer);
//...
cb.setConverter(new StringConverter<Person>() {
@Override
Expand All @@ -32,9 +34,7 @@ public String toString(Person p) {
@Override
public Person fromString(String string) {
// muss für diesen Anwendungsfall nicht implementiert sein
throw new UnsupportedOperationException("Not"
+ "supported yet."
);
throw new UnsupportedOperationException("Not supported yet.");
}
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
/*
* 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 de.javafxbuch;

public class Person {
String lastName;
String firstName;
int age;
public Person(String firstName, String lastName, int age) {
this.lastName = lastName;
this.firstName = firstName;
this.age = age;
}
public String getLastName() {
return lastName;
}
public String getFirstName() {
return firstName;
}
public int getAge() {
return age;
} }
String lastName;
String firstName;
int age;

public Person(String firstName, String lastName, int age) {
this.lastName = lastName;
this.firstName = firstName;
this.age = age;
}

public String getLastName() {
return lastName;
}

public String getFirstName() {
return firstName;
}

public int getAge() {
return age;
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
package de.javafxbuch;

import javafx.application.Application;
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.geometry.VPos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.ColumnConstraints;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Priority;
import javafx.scene.layout.RowConstraints;
import javafx.stage.Stage;

public class MainApp extends Application {
Expand All @@ -24,10 +19,32 @@ public static void main(String[] args) throws Exception {

@Override
public void start(Stage primaryStage) {

GridPane gridPane = new GridPane();
gridPane.setVgap(5);
gridPane.setHgap(8);
gridPane.setPadding(new Insets(10));

Image image = new Image(getClass()
.getResource("duke-wave.png")
.toExternalForm(), 100, 100, true, true);
final ImageView logo = new ImageView(image);
gridPane.add(logo, 3, 0);

Label heading = new Label("This is a GridPane");
gridPane.add(heading, 0, 0, 3, 1);

gridPane.add(new Label("Name:"), 1, 1);
gridPane.add(new TextField("Name eingeben"), 2, 1);
gridPane.add(new Label("Beruf:"), 1, 2);
gridPane.add(new TextField("Beruf eingeben"), 2, 2);
gridPane.add(new Button("speichern"), 3, 4);

gridPane.setGridLinesVisible(true);

Scene scene = new Scene(gridPane, 400,160);
primaryStage.setScene(scene);
primaryStage.show();
}

}