From afb4948491188cdcd892bd85bad259836039cb59 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 14 Mar 2024 20:16:13 -0600 Subject: [PATCH] =?UTF-8?q?Presentaci=C3=B3n=20y=20Diapositiva?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mycompany/presentadorjfx/Diapositiva.java | 21 +++++ .../presentadorjfx/Presentacion.java | 90 +++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 PresentadorJFX/src/main/java/com/mycompany/presentadorjfx/Diapositiva.java create mode 100644 PresentadorJFX/src/main/java/com/mycompany/presentadorjfx/Presentacion.java diff --git a/PresentadorJFX/src/main/java/com/mycompany/presentadorjfx/Diapositiva.java b/PresentadorJFX/src/main/java/com/mycompany/presentadorjfx/Diapositiva.java new file mode 100644 index 0000000..70e1c66 --- /dev/null +++ b/PresentadorJFX/src/main/java/com/mycompany/presentadorjfx/Diapositiva.java @@ -0,0 +1,21 @@ +/* + * 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 com.gumoio.presentador; + +import javafx.scene.Parent; +import javafx.scene.Scene; + +/** + * + * @author Juan + */ +public class Diapositiva extends Scene{ + + public Diapositiva(ModeloDiapositiva md) { + super(md,800,600); + } + +} \ No newline at end of file diff --git a/PresentadorJFX/src/main/java/com/mycompany/presentadorjfx/Presentacion.java b/PresentadorJFX/src/main/java/com/mycompany/presentadorjfx/Presentacion.java new file mode 100644 index 0000000..2d9dee1 --- /dev/null +++ b/PresentadorJFX/src/main/java/com/mycompany/presentadorjfx/Presentacion.java @@ -0,0 +1,90 @@ +/* + * 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 com.gumoio.presentador; + +import java.util.ArrayList; +import java.util.List; +import javafx.scene.Node; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.layout.HBox; +import javafx.scene.layout.VBox; +import javafx.stage.Stage; + +/** + * + * @author Juan + */ +public class Presentacion { + private Stage controlDiapositivas; + private Stage ventanaDiapositivas; + private List diapositivas; + private int diapositivaActual; + + public Presentacion(Stage primaryStage) { + controlDiapositivas = primaryStage; + ventanaDiapositivas = new Stage(); + diapositivas = new ArrayList<>(); + diapositivaActual = 0; + Button btnAtras = new Button(""); + btnAtras.setOnAction( + event -> { + if(diapositivaActual > 0) { + diapositivaActual --; + ventanaDiapositivas.setScene(diapositivas.get(diapositivaActual)); + } + } + ); + + + Button btnAdelante = new Button(""); + btnAdelante.setOnAction( + event -> { + int limiteSuperior = diapositivas.size() - 1; + if(diapositivaActual < limiteSuperior) { + diapositivaActual++; + ventanaDiapositivas.setScene(diapositivas.get(diapositivaActual)); + } + } + ); + + Button btnDetener = new Button(""); + btnDetener.setOnAction( + event -> { + System.exit(0); + } + ); + + primaryStage.setOnCloseRequest( + event -> System.exit(0) + ); + + HBox hboxPane = new HBox(btnAtras, btnDetener, btnAdelante); + hboxPane.setSpacing(20); + Scene control = new Scene(hboxPane); + controlDiapositivas.setTitle("Presentador FX"); + controlDiapositivas.setResizable(false); + controlDiapositivas.setScene(control); + } + + public void mostrar() { + controlDiapositivas.setAlwaysOnTop(true); + controlDiapositivas.show(); + if(this.diapositivas.size()>0) { + ventanaDiapositivas.setScene(diapositivas.get(0)); + ventanaDiapositivas.show(); + } + + + } + + + public void agregarDiapositiva(Diapositiva diapositiva) { + diapositivas.add(diapositiva); + } + +}