Added icons to dialogs.

Updated code style.
This commit is contained in:
Chris Cromer 2016-06-29 00:11:24 -04:00
parent bfab986c62
commit f4a103b3cc
12 changed files with 28 additions and 0 deletions

View File

@ -148,6 +148,7 @@ public class ArrayController implements Initializable {
dialog.setContentText(resourceBundle.getString("arrayValorExiste")); dialog.setContentText(resourceBundle.getString("arrayValorExiste"));
} }
dialog.getDialogPane().getButtonTypes().add(botonCerrar); dialog.getDialogPane().getButtonTypes().add(botonCerrar);
Main.setIcon(dialog, getClass());
dialog.show(); dialog.show();
} }
} }
@ -245,6 +246,7 @@ public class ArrayController implements Initializable {
dialog.setTitle(resourceBundle.getString("error")); dialog.setTitle(resourceBundle.getString("error"));
dialog.setContentText(resourceBundle.getString("arrayNoValor")); dialog.setContentText(resourceBundle.getString("arrayNoValor"));
dialog.getDialogPane().getButtonTypes().add(botonCerrar); dialog.getDialogPane().getButtonTypes().add(botonCerrar);
Main.setIcon(dialog, getClass());
dialog.show(); dialog.show();
} }
@ -257,6 +259,7 @@ public class ArrayController implements Initializable {
dialog.setTitle(resourceBundle.getString("error")); dialog.setTitle(resourceBundle.getString("error"));
dialog.setContentText(resourceBundle.getString("arrayNoEsta")); dialog.setContentText(resourceBundle.getString("arrayNoEsta"));
dialog.getDialogPane().getButtonTypes().add(botonCerrar); dialog.getDialogPane().getButtonTypes().add(botonCerrar);
Main.setIcon(dialog, getClass());
dialog.show(); dialog.show();
} }

View File

@ -152,6 +152,7 @@ public class BurbujaController implements Initializable {
dialog.setTitle(resourceBundle.getString("error")); dialog.setTitle(resourceBundle.getString("error"));
dialog.setContentText(resourceBundle.getString("burbujaYaOrdenado")); dialog.setContentText(resourceBundle.getString("burbujaYaOrdenado"));
dialog.getDialogPane().getButtonTypes().add(botonCerrar); dialog.getDialogPane().getButtonTypes().add(botonCerrar);
Main.setIcon(dialog, getClass());
dialog.show(); dialog.show();
} }

View File

@ -138,6 +138,7 @@ public class ColaController implements Initializable {
dialog.setTitle(resourceBundle.getString("error")); dialog.setTitle(resourceBundle.getString("error"));
dialog.setContentText(resourceBundle.getString("colaLlena")); dialog.setContentText(resourceBundle.getString("colaLlena"));
dialog.getDialogPane().getButtonTypes().add(botonCerrar); dialog.getDialogPane().getButtonTypes().add(botonCerrar);
Main.setIcon(dialog, getClass());
dialog.show(); dialog.show();
} }
} }
@ -209,6 +210,7 @@ public class ColaController implements Initializable {
dialog.setTitle(resourceBundle.getString("error")); dialog.setTitle(resourceBundle.getString("error"));
dialog.setContentText(resourceBundle.getString("colaNoValor")); dialog.setContentText(resourceBundle.getString("colaNoValor"));
dialog.getDialogPane().getButtonTypes().add(botonCerrar); dialog.getDialogPane().getButtonTypes().add(botonCerrar);
Main.setIcon(dialog, getClass());
dialog.show(); dialog.show();
} }
@ -221,6 +223,7 @@ public class ColaController implements Initializable {
dialog.setTitle(resourceBundle.getString("error")); dialog.setTitle(resourceBundle.getString("error"));
dialog.setContentText(resourceBundle.getString("colaVacia")); dialog.setContentText(resourceBundle.getString("colaVacia"));
dialog.getDialogPane().getButtonTypes().add(botonCerrar); dialog.getDialogPane().getButtonTypes().add(botonCerrar);
Main.setIcon(dialog, getClass());
dialog.show(); dialog.show();
} }

View File

@ -152,6 +152,7 @@ public class InsercionController implements Initializable {
dialog.setTitle(resourceBundle.getString("error")); dialog.setTitle(resourceBundle.getString("error"));
dialog.setContentText(resourceBundle.getString("insercionYaOrdenado")); dialog.setContentText(resourceBundle.getString("insercionYaOrdenado"));
dialog.getDialogPane().getButtonTypes().add(botonCerrar); dialog.getDialogPane().getButtonTypes().add(botonCerrar);
Main.setIcon(dialog, getClass());
dialog.show(); dialog.show();
} }

View File

@ -189,6 +189,7 @@ public class ListaEnlazdaController implements Initializable {
dialog.setTitle(resourceBundle.getString("error")); dialog.setTitle(resourceBundle.getString("error"));
dialog.setContentText(resourceBundle.getString("listaLlaveExiste")); dialog.setContentText(resourceBundle.getString("listaLlaveExiste"));
dialog.getDialogPane().getButtonTypes().add(botonCerrar); dialog.getDialogPane().getButtonTypes().add(botonCerrar);
Main.setIcon(dialog, getClass());
dialog.show(); dialog.show();
} }
} }
@ -326,6 +327,7 @@ public class ListaEnlazdaController implements Initializable {
dialog.setTitle(resourceBundle.getString("error")); dialog.setTitle(resourceBundle.getString("error"));
dialog.setContentText(resourceBundle.getString("listaNoValor")); dialog.setContentText(resourceBundle.getString("listaNoValor"));
dialog.getDialogPane().getButtonTypes().add(botonCerrar); dialog.getDialogPane().getButtonTypes().add(botonCerrar);
Main.setIcon(dialog, getClass());
dialog.show(); dialog.show();
} }
@ -338,6 +340,7 @@ public class ListaEnlazdaController implements Initializable {
dialog.setTitle(resourceBundle.getString("error")); dialog.setTitle(resourceBundle.getString("error"));
dialog.setContentText(resourceBundle.getString("listaNoEsta")); dialog.setContentText(resourceBundle.getString("listaNoEsta"));
dialog.getDialogPane().getButtonTypes().add(botonCerrar); dialog.getDialogPane().getButtonTypes().add(botonCerrar);
Main.setIcon(dialog, getClass());
dialog.show(); dialog.show();
} }

View File

@ -4,6 +4,7 @@ import javafx.application.Application;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.scene.Parent; import javafx.scene.Parent;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.control.Dialog;
import javafx.scene.image.Image; import javafx.scene.image.Image;
import javafx.stage.Stage; import javafx.stage.Stage;
@ -66,4 +67,9 @@ public class Main extends Application {
stage.getIcons().add(new Image(getClass().getResourceAsStream("/cl/cromer/estructuras/images/icon.png"))); stage.getIcons().add(new Image(getClass().getResourceAsStream("/cl/cromer/estructuras/images/icon.png")));
stage.show(); stage.show();
} }
static public void setIcon(Dialog dialog, Class classe) {
Stage stage = (Stage) dialog.getDialogPane().getScene().getWindow();
stage.getIcons().add(new Image(classe.getResourceAsStream("/cl/cromer/estructuras/images/icon.png")));
}
} }

View File

@ -6,6 +6,7 @@ import javafx.fxml.Initializable;
import javafx.scene.Parent; import javafx.scene.Parent;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.image.Image;
import javafx.scene.layout.VBox; import javafx.scene.layout.VBox;
import javafx.stage.Stage; import javafx.stage.Stage;
@ -221,6 +222,7 @@ public class MenuController extends VBox implements Initializable {
dialog.getDialogPane().getButtonTypes().add(botonCancelar); dialog.getDialogPane().getButtonTypes().add(botonCancelar);
dialog.getDialogPane().getButtonTypes().add(botonCambiar); dialog.getDialogPane().getButtonTypes().add(botonCambiar);
dialog.getDialogPane().setPrefSize(400, 120); dialog.getDialogPane().setPrefSize(400, 120);
Main.setIcon(dialog, getClass());
Optional<ButtonType> result = dialog.showAndWait(); Optional<ButtonType> result = dialog.showAndWait();
if (result.isPresent() && result.get() == botonCambiar) { if (result.isPresent() && result.get() == botonCambiar) {
@ -249,6 +251,7 @@ public class MenuController extends VBox implements Initializable {
dialog.getDialogPane().getButtonTypes().add(botonCancelar); dialog.getDialogPane().getButtonTypes().add(botonCancelar);
dialog.getDialogPane().getButtonTypes().add(botonCambiar); dialog.getDialogPane().getButtonTypes().add(botonCambiar);
dialog.getDialogPane().setPrefSize(400, 120); dialog.getDialogPane().setPrefSize(400, 120);
Main.setIcon(dialog, getClass());
Optional<ButtonType> result = dialog.showAndWait(); Optional<ButtonType> result = dialog.showAndWait();
if (result.isPresent() && result.get() == botonCambiar) { if (result.isPresent() && result.get() == botonCambiar) {
@ -274,6 +277,7 @@ public class MenuController extends VBox implements Initializable {
dialog.setTitle(resourceBundle.getString("acerca")); dialog.setTitle(resourceBundle.getString("acerca"));
dialog.setContentText(resourceBundle.getString("credito")); dialog.setContentText(resourceBundle.getString("credito"));
dialog.getDialogPane().getButtonTypes().add(botonCerrar); dialog.getDialogPane().getButtonTypes().add(botonCerrar);
Main.setIcon(dialog, getClass());
dialog.show(); dialog.show();
} }

View File

@ -152,6 +152,7 @@ public class MergeController implements Initializable {
dialog.setTitle(resourceBundle.getString("error")); dialog.setTitle(resourceBundle.getString("error"));
dialog.setContentText(resourceBundle.getString("mergeYaOrdenado")); dialog.setContentText(resourceBundle.getString("mergeYaOrdenado"));
dialog.getDialogPane().getButtonTypes().add(botonCerrar); dialog.getDialogPane().getButtonTypes().add(botonCerrar);
Main.setIcon(dialog, getClass());
dialog.show(); dialog.show();
} }

View File

@ -138,6 +138,7 @@ public class PilaController implements Initializable {
dialog.setTitle(resourceBundle.getString("error")); dialog.setTitle(resourceBundle.getString("error"));
dialog.setContentText(resourceBundle.getString("pilaLlena")); dialog.setContentText(resourceBundle.getString("pilaLlena"));
dialog.getDialogPane().getButtonTypes().add(botonCerrar); dialog.getDialogPane().getButtonTypes().add(botonCerrar);
Main.setIcon(dialog, getClass());
dialog.show(); dialog.show();
} }
} }
@ -209,6 +210,7 @@ public class PilaController implements Initializable {
dialog.setTitle(resourceBundle.getString("error")); dialog.setTitle(resourceBundle.getString("error"));
dialog.setContentText(resourceBundle.getString("pilaNoValor")); dialog.setContentText(resourceBundle.getString("pilaNoValor"));
dialog.getDialogPane().getButtonTypes().add(botonCerrar); dialog.getDialogPane().getButtonTypes().add(botonCerrar);
Main.setIcon(dialog, getClass());
dialog.show(); dialog.show();
} }
@ -221,6 +223,7 @@ public class PilaController implements Initializable {
dialog.setTitle(resourceBundle.getString("error")); dialog.setTitle(resourceBundle.getString("error"));
dialog.setContentText(resourceBundle.getString("pilaVacia")); dialog.setContentText(resourceBundle.getString("pilaVacia"));
dialog.getDialogPane().getButtonTypes().add(botonCerrar); dialog.getDialogPane().getButtonTypes().add(botonCerrar);
Main.setIcon(dialog, getClass());
dialog.show(); dialog.show();
} }

View File

@ -152,6 +152,7 @@ public class QuickController implements Initializable {
dialog.setTitle(resourceBundle.getString("error")); dialog.setTitle(resourceBundle.getString("error"));
dialog.setContentText(resourceBundle.getString("quickYaOrdenado")); dialog.setContentText(resourceBundle.getString("quickYaOrdenado"));
dialog.getDialogPane().getButtonTypes().add(botonCerrar); dialog.getDialogPane().getButtonTypes().add(botonCerrar);
Main.setIcon(dialog, getClass());
dialog.show(); dialog.show();
} }

View File

@ -152,6 +152,7 @@ public class SeleccionController implements Initializable {
dialog.setTitle(resourceBundle.getString("error")); dialog.setTitle(resourceBundle.getString("error"));
dialog.setContentText(resourceBundle.getString("seleccionYaOrdenado")); dialog.setContentText(resourceBundle.getString("seleccionYaOrdenado"));
dialog.getDialogPane().getButtonTypes().add(botonCerrar); dialog.getDialogPane().getButtonTypes().add(botonCerrar);
Main.setIcon(dialog, getClass());
dialog.show(); dialog.show();
} }

View File

@ -152,6 +152,7 @@ public class ShellController implements Initializable {
dialog.setTitle(resourceBundle.getString("error")); dialog.setTitle(resourceBundle.getString("error"));
dialog.setContentText(resourceBundle.getString("shellYaOrdenado")); dialog.setContentText(resourceBundle.getString("shellYaOrdenado"));
dialog.getDialogPane().getButtonTypes().add(botonCerrar); dialog.getDialogPane().getButtonTypes().add(botonCerrar);
Main.setIcon(dialog, getClass());
dialog.show(); dialog.show();
} }