here it's the code where I try to initialize the add the checkbox to my tableView, im also working with SceneBuilder but it makes me impossible to do it.
private void inicializarTablaPersonas() {
nombreCL.setCellValueFactory(new PropertyValueFactory<Jugador, String>("nombre"));
apellidoCL.setCellValueFactory(new PropertyValueFactory<Jugador, String>("apellido"));
numCL.setCellValueFactory(new PropertyValueFactory<Jugador, Integer>("Nº"));
posCL.setCellValueFactory(new PropertyValueFactory<Jugador, String>("pos"));
TableColumn<Jugador,Boolean> checkEnCancha = new TableColumn<Jugador,Boolean>("enCancha");//probando
checkEnCancha.setCellValueFactory(new PropertyValueFactory<Jugador,Boolean>("checkEnCanchaValue"));//probando
checkEnCancha.setCellFactory(CheckBoxTableCell.forTableColumn(checkEnCancha));//probando
// enCanchaCL.setCellFactory(new PropertyValueFactory<Jugador, String>("enCancha"));//NOSE SI esta bien
jugadores = FXCollections.observableArrayList();
tablaJugadores.setItems(jugadores);
}
and here it is the fxml.
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.Cursor?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.effect.Blend?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.text.Font?>
<BorderPane prefHeight="600.0" prefWidth="800.0" xmlns="http://ift.tt/2kyUh32" xmlns:fx="http://ift.tt/1cgvoBb" fx:controller="stats.nuevoPartidoController">
<top>
<Label text="Nuevo Partido" BorderPane.alignment="CENTER">
<font>
<Font size="18.0" />
</font>
</Label>
</top>
<center>
<SplitPane dividerPositions="0.8537234042553191" orientation="VERTICAL" prefHeight="200.0" prefWidth="160.0" BorderPane.alignment="CENTER">
<items>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="0.0" prefWidth="0.0">
<children>
<TableView fx:id="tablaJugadores" layoutX="-1.0" layoutY="-5.0" maxHeight="328.0" prefHeight="328.0" prefWidth="405.0">
<columns>
<TableColumn fx:id="numCL" maxWidth="1800.0" minWidth="0.0" prefWidth="15.0" text="Nº" />
<TableColumn fx:id="nombreCL" maxWidth="3500.0" prefWidth="100.0" text="nombre" />
<TableColumn fx:id="apellidoCL" maxWidth="3500.0" prefWidth="121.0" text="apellido" />
<TableColumn fx:id="posCL" maxWidth="1800.0" prefWidth="43.0" text="pos" />
<TableColumn fx:id="enCanchaCL" maxWidth="1800.0" prefWidth="43.0" text="EnCancha" />
</columns>
<columnResizePolicy>
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
</columnResizePolicy>
</TableView>
<AnchorPane layoutX="405.0" prefHeight="315.0" prefWidth="261.0">
<children>
<ImageView fitHeight="318.0" fitWidth="351.0">
<image>
<Image url="@../../../../Desktop/esEsta.jpg" />
</image>
</ImageView>
<CheckBox id="in_2_i_90" layoutX="39.0" layoutY="37.0" mnemonicParsing="false" text="in" />
<CheckBox id="out_2_i_90" layoutX="39.0" layoutY="64.0" mnemonicParsing="false" text="out" />
</children>
</AnchorPane>
</children>
<effect>
<Blend mode="LIGHTEN" />
</effect>
<cursor>
<Cursor fx:constant="DEFAULT" />
</cursor>
</AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="51.0" prefWidth="300.0">
<children>
<TextField fx:id="numero" layoutX="1.0" layoutY="-1.0" maxWidth="45.0" prefHeight="25.0" prefWidth="44.0" snapToPixel="false" text="Nº " />
<TextField fx:id="nombre" layoutX="60.0" layoutY="-1.0" maxWidth="89.0" prefHeight="25.0" prefWidth="89.0" text="nombre" />
<TextField fx:id="apellido" layoutX="168.0" layoutY="-1.0" maxWidth="95.0" prefHeight="25.0" prefWidth="95.0" text="apellido" />
<TextField fx:id="posicion" layoutX="283.0" layoutY="-3.0" maxWidth="57.0" prefHeight="25.0" prefWidth="57.0" text="pos" />
<Button fx:id="aniadirJugadorBT" layoutX="5.0" layoutY="25.0" mnemonicParsing="false" onAction="#AniadirJugador" prefHeight="25.0" prefWidth="326.0" text="Añadir Jugador" />
</children>
</AnchorPane>
</items>
</SplitPane>
</center>
</BorderPane>
I hope you could understand me question! NICK
Aucun commentaire:
Enregistrer un commentaire