Presentación y Diapositiva

This commit is contained in:
David 2024-03-14 20:16:13 -06:00
parent a0e947173e
commit afb4948491
2 changed files with 111 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -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 <Diapositiva> diapositivas;
private int diapositivaActual;
public Presentacion(Stage primaryStage) {
controlDiapositivas = primaryStage;
ventanaDiapositivas = new Stage();
diapositivas = new ArrayList<>();
diapositivaActual = 0;
Button btnAtras = new Button("<Atrás>");
btnAtras.setOnAction(
event -> {
if(diapositivaActual > 0) {
diapositivaActual --;
ventanaDiapositivas.setScene(diapositivas.get(diapositivaActual));
}
}
);
Button btnAdelante = new Button("<Adelante>");
btnAdelante.setOnAction(
event -> {
int limiteSuperior = diapositivas.size() - 1;
if(diapositivaActual < limiteSuperior) {
diapositivaActual++;
ventanaDiapositivas.setScene(diapositivas.get(diapositivaActual));
}
}
);
Button btnDetener = new Button("<Detener>");
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);
}
}