Skip to content

Commit

Permalink
Optimizando código
Browse files Browse the repository at this point in the history
  • Loading branch information
valeria authored and valeria committed Sep 3, 2019
1 parent a5fb9c8 commit e93ded5
Showing 1 changed file with 26 additions and 20 deletions.
46 changes: 26 additions & 20 deletions TyperBalloons/src/Vistas/VistaJuego1.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,36 +93,18 @@ public Pane crearElementos(){
imv = new ImageView(new Image(CONSTANTES.RUTA_IMGS+"BG_04.png"));
}

Label lg = new Label("Numero de \n Globos:");

lg.setFont(theFont);
Image img = new Image(getClass().getResourceAsStream(
CONSTANTES.RUTA_IMGS+"Globo_Blanco.png"),
100,
200,
true,
true);
ImageView im_marcador= new ImageView(img);
Pane p = new Pane();
globos = new Label(String.valueOf(numeroGlobos));
globos.setFont(theFont);
globos.setLayoutX(20);
globos.setLayoutY(20);
p.getChildren().addAll(im_marcador,globos);
HBox marcador= new HBox();
marcador.setSpacing(20);
marcador.getChildren().addAll(lg,p);
marcador.setLayoutX(540);
marcador.setLayoutY(40);

Button b = new Button();
b.setLayoutY(100);
HBox tiempocontenedor= contenedorTiempo();
HBox marcador= marcadorCont();
raiz.getChildren().addAll(new Button(),b,imv,tiempocontenedor,gpane,onRoot,marcador,pMessage);
raiz.setOnKeyPressed(e->{
String letra = e.getText();
Iterator <Globo> iterator = globoslista.iterator();
while(iterator.hasNext()){

Globo g = iterator.next();
if(g.getLetras().contains(letra) && g.onScreen){
Platform.runLater(()->onRoot.getChildren().clear());
Expand All @@ -140,6 +122,30 @@ public Pane crearElementos(){
return raiz;
}

public HBox marcadorCont(){
Label lg = new Label("Numero de \n Globos:");

lg.setFont(theFont);
Image img = new Image(getClass().getResourceAsStream(
CONSTANTES.RUTA_IMGS+"Globo_Blanco.png"),
100,
200,
true,
true);
ImageView im_marcador= new ImageView(img);
Pane p = new Pane();
globos = new Label(String.valueOf(numeroGlobos));
globos.setFont(theFont);
globos.setLayoutX(20);
globos.setLayoutY(20);
p.getChildren().addAll(im_marcador,globos);
HBox marcador= new HBox();
marcador.setSpacing(20);
marcador.getChildren().addAll(lg,p);
marcador.setLayoutX(540);
marcador.setLayoutY(40);
return marcador;
}


public HBox contenedorTiempo(){
Expand Down

0 comments on commit e93ded5

Please sign in to comment.