在表列单元格中添加Textarea,而不是标题
我正在参加学校的顶峰项目。它正在完全工作。我正在尝试完成一些修饰物品。基本上,您创建一个帐户。添加您要出售的商品,并查看其出售商品的其他帐户。然后购买物品。好吧,我有一个“ ViewPane”,它将其他帐户存储在带有一些标签的Vbox中,然后是一个带有三列,项目名称,描述和项目价格的tableview。好吧,我想在描述列中添加文本方面。因此,这样的方式不会被列的宽度截断。
VBox vbAccount = new VBox(10);
Label lbName = new Label(accounts.get(pageIndex).getAccountName());
Account a = accounts.get(pageIndex);
Label lbItemCount = new Label("Items: " + accounts.get(pageIndex).getItemCount());
vbAccount.getChildren().addAll(lbName, lbItemCount, tbvAccounts, hbButtons);
vbAccount.setAlignment(Pos.TOP_CENTER);
Account current = accounts.get(pageIndex);
ObservableList<Item> itemList =
FXCollections.observableArrayList(current.getItems());
tbvAccounts.setMaxSize(302, 300);
tbvAccounts.setItems(itemList);
TableColumn nameCol = new TableColumn("Item Name");
nameCol.setMinWidth(100);
nameCol.setCellValueFactory(
new PropertyValueFactory<Item, String>("itemName"));
TableColumn descriptionCol = new TableColumn("Description");
descriptionCol.setMinWidth(150);
descriptionCol.setCellValueFactory(
new PropertyValueFactory<Item, String>("description"));
TextArea taDescription = new TextArea();
TableColumn priceCol = new TableColumn("Item Price");
priceCol.setMinWidth(100);
priceCol.setCellValueFactory(
new PropertyValueFactory<Item, Double>("itemPrice"));
tbvAccounts.getColumns().addAll(nameCol, descriptionCol, priceCol);
我已经链接了我的表列的创建方式。如果有人有答案。请给我发消息,谢谢。
I am on a capstone project for school. It is working completely. I am trying to finish up a few touch up items. Basically, You create an account. Add Items to account you want to sell, and view other accounts of items they are selling. Then buy the items. Well I have a "ViewPane" which stores the other accounts in a VBox with some labels for info, then a TableView which has three columns, Item Name, Description, and Item Price. Well I would like to add a TextArea to the Description Column. So that way the text shown is not truncated by the width of the column.
VBox vbAccount = new VBox(10);
Label lbName = new Label(accounts.get(pageIndex).getAccountName());
Account a = accounts.get(pageIndex);
Label lbItemCount = new Label("Items: " + accounts.get(pageIndex).getItemCount());
vbAccount.getChildren().addAll(lbName, lbItemCount, tbvAccounts, hbButtons);
vbAccount.setAlignment(Pos.TOP_CENTER);
Account current = accounts.get(pageIndex);
ObservableList<Item> itemList =
FXCollections.observableArrayList(current.getItems());
tbvAccounts.setMaxSize(302, 300);
tbvAccounts.setItems(itemList);
TableColumn nameCol = new TableColumn("Item Name");
nameCol.setMinWidth(100);
nameCol.setCellValueFactory(
new PropertyValueFactory<Item, String>("itemName"));
TableColumn descriptionCol = new TableColumn("Description");
descriptionCol.setMinWidth(150);
descriptionCol.setCellValueFactory(
new PropertyValueFactory<Item, String>("description"));
TextArea taDescription = new TextArea();
TableColumn priceCol = new TableColumn("Item Price");
priceCol.setMinWidth(100);
priceCol.setCellValueFactory(
new PropertyValueFactory<Item, Double>("itemPrice"));
tbvAccounts.getColumns().addAll(nameCol, descriptionCol, priceCol);
I have linked the way my Table Columns are created. If anyone has an answer. Please message me, Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论