본문 바로가기

개발/JavaFX

javafx Scene Builder TableView test data

javafx의 tableView 구현시 이것저것 확인해 보기 위한 TableView.fxml 입니다.



완벽한 내용은 아닙니다만 스크롤은 생성되는 정도까지 나타납니다.


tableView 구조 파악에 도움 되시길.


 <?xml version="1.0" encoding="UTF-8"?>


<?import javafx.scene.control.TableColumn?>

<?import javafx.scene.control.TableView?>

<?import javafx.scene.control.cell.PropertyValueFactory?>

<?import javafx.scene.layout.BorderPane?>

<?import javafx.scene.control.cell.*?> 

<?import javafx.collections.*?> 

<?import fxmltableview.*?> 

<?import java.lang.String?>


<BorderPane xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.65">

    <center>

        <TableView fx:id="table">

            <columns>

<TableColumn text="First Name">

<cellValueFactory><PropertyValueFactory property="firstName" />

</cellValueFactory>

</TableColumn>

<TableColumn text="Last Name">

<cellValueFactory><PropertyValueFactory property="lastName" />

</cellValueFactory>

</TableColumn>

<TableColumn text="Email Address">

<cellValueFactory><PropertyValueFactory property="email" />

</cellValueFactory>

</TableColumn>

</columns> 

<items>

            <FXCollections fx:factory="observableArrayList">

                <String fx:value="Item 1" />

                <String fx:value="Item 2" />

<String fx:value="Item 2" />

<String fx:value="Item 2" />

<String fx:value="Item 2" />

<String fx:value="Item 2" />

<String fx:value="Item 2" />

<String fx:value="Item 2" />

<String fx:value="Item 2" />

<String fx:value="Item 2" />

<String fx:value="Item 2" />

<String fx:value="Item 2" />

<String fx:value="Item 2" />

<String fx:value="Item 2" />

<String fx:value="Item 2" />

<String fx:value="Item 2" />

<String fx:value="Item 2" />

<String fx:value="Item 2" />

<String fx:value="Item 2" />

<String fx:value="Item 2" />

                                <String fx:value="Item 3" />

                                <String fx:value="Item 4" />

            </FXCollections>        

          </items>

        </TableView>

    </center>

</BorderPane>