Changed width handling for the table

This commit is contained in:
Chris Cromer 2017-06-29 00:47:20 -04:00
parent e8268e1ba5
commit cf7a6f016f

View File

@ -7,6 +7,7 @@
package mt; package mt;
import com.sun.javafx.scene.control.skin.TableHeaderRow;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable; import javafx.fxml.Initializable;
@ -69,9 +70,13 @@ public class MenuController extends VBox implements Initializable {
contenido.getChildren().add(tableView); contenido.getChildren().add(tableView);
TableColumn tableColumn1 = (TableColumn) tableView.getColumns().get(0); TableColumn tableColumn1 = (TableColumn) tableView.getColumns().get(0);
TableColumn tableColumn2 = (TableColumn) tableView.getColumns().get(1); TableColumn tableColumn2 = (TableColumn) tableView.getColumns().get(1);
tableColumn1.setMaxWidth(1f * Integer.MAX_VALUE * 50); tableView.skinProperty().addListener((source, oldWidth, newWidth) -> {
tableColumn2.setMaxWidth(1f * Integer.MAX_VALUE * 50); final TableHeaderRow header = (TableHeaderRow) tableView.lookup("TableHeaderRow");
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); header.reorderingProperty().addListener((observable, oldValue, newValue) -> header.setReordering(false));
});
tableColumn1.prefWidthProperty().bind(tableView.widthProperty().multiply(0.5));
tableColumn2.prefWidthProperty().bind(tableView.widthProperty().multiply(0.5));
/*if (maquina.comprobarCadena(new StringBuilder("000111###"), 5)) { /*if (maquina.comprobarCadena(new StringBuilder("000111###"), 5)) {
MT.mostrarMensaje("Resultado", "Reconce"); MT.mostrarMensaje("Resultado", "Reconce");
} }