Skip to content

Commit

Permalink
Merge commit 'ffa0af18d4d0fdb126d1fadca870bafeeff297c3' into App
Browse files Browse the repository at this point in the history
* commit 'ffa0af18d4d0fdb126d1fadca870bafeeff297c3':
  Fix Issues
  Removed inused imports and fix some peek problems
  Add gitignore
  • Loading branch information
AlexVelezLl committed May 16, 2020
2 parents 492704e + ffa0af1 commit 58703d3
Show file tree
Hide file tree
Showing 6 changed files with 687 additions and 712 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/nbproject/private/
12 changes: 6 additions & 6 deletions src/Interfaz/Index.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Interfaz;
package interfaz;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;

/**
*
* @author CORE i7 ULTIMATE
* @author AlexVelezLl
*/
public class Index extends Application{
public static void main(String [] args){
public class Index extends Application {
public static void main(String[] args) {
launch(args);
}

@Override
public void start(Stage primaryStage) throws Exception {
InterfazArbol ia = new InterfazArbol();
Scene sc = new Scene(ia.getRoot(),1366,768);
Scene sc = new Scene(ia.getRoot(), 1366, 768);
primaryStage.setScene(sc);
primaryStage.setFullScreen(true);
primaryStage.setResizable(false);
primaryStage.show();

}
}
93 changes: 43 additions & 50 deletions src/Interfaz/InterfazArbol.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Interfaz;
package interfaz;

import java.util.ArrayList;
import javafx.application.Platform;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
Expand All @@ -17,14 +16,8 @@
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.LineTo;
import javafx.scene.shape.MoveTo;
import javafx.scene.shape.Path;
import javafx.scene.shape.PathElement;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Font;
import javafx.scene.text.FontPosture;
import javafx.scene.text.FontWeight;
import tda.AVL;

Expand All @@ -36,17 +29,16 @@ public class InterfazArbol {
private Pane root;
private AVL<Integer> avlTree;
private ScrollPane sp;
public InterfazArbol(){

public InterfazArbol() {
root = new VBox();
avlTree = new AVL<>(Integer::compareTo);
sp = new ScrollPane();

createRoot();
}
private void createRoot(){
Rectangle topRect = new Rectangle(1366,75);

private void createRoot() {
Rectangle topRect = new Rectangle(1366, 75);
topRect.setFill(Color.DARKCYAN);
Label lblAvl = new Label("AVL TREE");
lblAvl.setTranslateX(30);
Expand All @@ -55,7 +47,7 @@ private void createRoot(){
lblAvl.setFont(theFont);
lblAvl.setTextFill(Color.WHITE);
Pane topPane = new Pane();
topPane.getChildren().addAll(topRect,lblAvl);
topPane.getChildren().addAll(topRect, lblAvl);
HBox hbOpc = new HBox();
hbOpc.setAlignment(Pos.CENTER);
hbOpc.setTranslateY(6);
Expand All @@ -64,88 +56,89 @@ private void createRoot(){
TextField txtDelete = new TextField();
Button btnDelete = new Button("Eliminar");
HBox hbInst = new HBox();
hbInst.getChildren().addAll(txtInsertar,btnInsertar);
hbInst.getChildren().addAll(txtInsertar, btnInsertar);
hbInst.setSpacing(5);
HBox hbDel = new HBox();
hbDel.getChildren().addAll(txtDelete,btnDelete);
hbDel.getChildren().addAll(txtDelete, btnDelete);
hbDel.setSpacing(5);
Button btnClear = new Button("Clear");
Pane pnClear = new Pane(btnClear);
hbOpc.getChildren().addAll(hbInst,hbDel,pnClear);
hbOpc.getChildren().addAll(hbInst, hbDel, pnClear);
hbOpc.setSpacing(30);
Rectangle optRect = new Rectangle(1366,40);
Rectangle optRect = new Rectangle(1366, 40);
optRect.setOpacity(0.7);
optRect.setFill(Color.CADETBLUE);
StackPane optStck = new StackPane();
optStck.getChildren().addAll(optRect,hbOpc);
optStck.getChildren().addAll(optRect, hbOpc);
StackPane arbol = new StackPane();
arbol.setMinHeight(200);
arbol.setMinWidth(1366);
btnClear.setOnMouseClicked(e->{
arbol.setMinWidth(avlTree.height() * 100);
btnClear.setOnMouseClicked(e -> {
avlTree = new AVL<>(Integer::compareTo);
arbol.getChildren().clear();
Pane avlPane = avlTree.mostrarArbol();
arbol.getChildren().add(avlPane);
arbol.setMinWidth(avlTree.height()*100);
arbol.setMinWidth(avlTree.height() * 100);
});
sp.setContent(arbol);
sp.setMinHeight(500);
sp.setMaxHeight(500);
btnInsertar.setOnAction(e->{
Integer num=0;
try{
btnInsertar.setOnAction(e -> {
Integer num = 0;
try {
num = Integer.parseInt(txtInsertar.getText());
txtInsertar.setText("");
txtInsertar.requestFocus();
avlTree.Insert(num);
avlTree.insert(num);

arbol.getChildren().clear();
Pane avlPane = avlTree.mostrarArbol();
if(avlTree.height()<=7) avlPane.setTranslateX(100*(7-avlTree.height()));
if (avlTree.height() <= 7)
avlPane.setTranslateX(100 * (7 - avlTree.height()));
arbol.getChildren().add(avlPane);
arbol.setMinWidth(avlTree.height()*100);
}catch(Exception ex){
arbol.setMinWidth(avlTree.height() * 100);
} catch (Exception ex) {

}

});
btnDelete.setOnMouseClicked(e->{
Integer num=0;
try{

btnDelete.setOnMouseClicked(e -> {
Integer num = 0;
try {
num = Integer.parseInt(txtDelete.getText());
txtDelete.setText("");
txtDelete.requestFocus();
avlTree.delete(num);
arbol.getChildren().clear();
Pane avlPane = avlTree.mostrarArbol();
if(avlTree.height()<=7) avlPane.setTranslateX(100*(7-avlTree.height()));
if (avlTree.height() <= 7)
avlPane.setTranslateX(100 * (7 - avlTree.height()));
arbol.getChildren().add(avlPane);
arbol.setMinWidth(avlTree.height()*100);
}catch(Exception ex){
arbol.setMinWidth(avlTree.height() * 100);

} catch (Exception ex) {

}
});



StackPane pnSalir = new StackPane();
Label lblSalir = new Label("Salir");
lblSalir.setFont(Font.font("Arial", FontWeight.BOLD, 40));
lblSalir.setTextFill(Color.RED);
pnSalir.getChildren().add(lblSalir);
pnSalir.setOnMouseClicked(e->{
pnSalir.setOnMouseClicked(e -> {
Platform.exit();
});
pnSalir.setTranslateY(30);
pnSalir.setTranslateX(20);
root.getChildren().addAll(topPane,optStck,sp,pnSalir);

root.getChildren().addAll(topPane, optStck, sp, pnSalir);

}


public Pane getRoot(){

public Pane getRoot() {
return root;
}
}
Loading

0 comments on commit 58703d3

Please sign in to comment.