Commit 915b24de authored by Bradley Richards's avatar Bradley Richards
Browse files

Merge branch 'master' of gitlab.fhnw.ch:bradley.richards/I_OOP2

parents 47cacbf8 ef031a28
package ch.fhnw.richards.lecture08_JavaFX_advanced.MouseDetector;
import javafx.application.Application;
import javafx.stage.Stage;
public class MouseDetector extends Application {
private MouseDetector_View view;
private MouseDetector_Controller controller;
private MouseDetector_Model model;
public static void main(String[] args) {
launch(args);
}
/**
* Note the dependencies between model, view and controller. Additionally,
* the view needs the primaryStage created by JavaFX.
*/
@Override
public void start(Stage primaryStage) {
// Initialize the GUI
model = new MouseDetector_Model();
view = new MouseDetector_View(primaryStage, model);
controller = new MouseDetector_Controller(model, view);
// Display the GUI after all initialization is complete
view.start();
}
}
package ch.fhnw.richards.lecture08_JavaFX_advanced.MouseDetector;
public class MouseDetector_Controller {
final private MouseDetector_Model model;
final private MouseDetector_View view;
protected MouseDetector_Controller(MouseDetector_Model model, MouseDetector_View view) {
this.model = model;
this.view = view;
// Add your code here !!!
}
}
package ch.fhnw.richards.lecture08_JavaFX_advanced.MouseDetector;
public class MouseDetector_Model {
protected MouseDetector_Model() {
// Empty - no model for this example
}
}
package ch.fhnw.richards.lecture08_JavaFX_advanced.MouseDetector;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
public class MouseDetector_View {
private MouseDetector_Model model;
private Stage stage;
protected Label lblDetector;
protected MouseDetector_View(Stage stage, MouseDetector_Model model) {
this.stage = stage;
this.model = model;
stage.setTitle("Mouse Detector");
GridPane root = new GridPane();
lblDetector = new Label("This is a label");
lblDetector.setMinSize(200, 200);
root.add(lblDetector, 0, 0);
Scene scene = new Scene(root);
stage.setScene(scene);;
}
public void start() {
stage.show();
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment