0
私はVBoxの中にTableViewを持っていて、私はTableViewで取り除くことができない本当にイライラスクロールバーがあります。これを取り除く助けに感謝します。VBox内のテーブルでスクロールバーを削除する方法(JavaFX)
私はTableViewの上に座っているラベルもあるので、基本的に私はVbox内にTableViewを持っています。これを達成する代替提案もすばらしいです。
コード:
private void setFlagTab(Tab FlagTab, String name, ArrayList<Flag> flagList){
TableView table = new TableView();
ObservableList<Flag> data = FXCollections.observableArrayList(flagList);
Label label = new Label("Flags identified for: " + name);
label.setFont(new Font("Arial", 20));
TableColumn startCol = new TableColumn("Start Time");
startCol.setCellValueFactory(
new PropertyValueFactory<Flag, String>("startTime"));
startCol.setSortable(false);
startCol.prefWidthProperty().bind(table.widthProperty().multiply(0.1));
TableColumn endCol = new TableColumn("End Time");
endCol.setCellValueFactory(
new PropertyValueFactory<Flag, String>("endTime"));
endCol.setSortable(false);
endCol.prefWidthProperty().bind(table.widthProperty().multiply(0.1));
TableColumn phaseCol = new TableColumn("Phase");
phaseCol.setCellValueFactory(
new PropertyValueFactory<Flag, String>("phase"));
phaseCol.setSortable(false);
phaseCol.prefWidthProperty().bind(table.widthProperty().multiply(0.2));
TableColumn messageCol = new TableColumn("Message");
messageCol.setCellValueFactory(
new PropertyValueFactory<Flag, String>("message"));
messageCol.setSortable(false);
messageCol.prefWidthProperty().bind(table.widthProperty().multiply(0.4));
TableColumn targetCol = new TableColumn("Target");
targetCol.setCellValueFactory(
new PropertyValueFactory<Flag, String>("target"));
targetCol.setSortable(false);
targetCol.prefWidthProperty().bind(table.widthProperty().multiply(0.1));
TableColumn actualCol = new TableColumn("Actual");
actualCol.setCellValueFactory(
new PropertyValueFactory<Flag, String>("actual"));
actualCol.setSortable(false);
actualCol.prefWidthProperty().bind(table.widthProperty().multiply(0.1));
table.setItems(data);
table.getColumns().addAll(startCol, endCol, phaseCol, messageCol, targetCol, actualCol);
VBox vbox = new VBox();
vbox.setSpacing(5);
vbox.setPadding(new Insets(10, 0, 0, 10));
vbox.getChildren().addAll(label, table);
FlagTab.setText("Flags");
FlagTab.setContent(vbox);
}
ありがとう!
こんにちは、あなたの答えに感謝:ポリシーのサイズを変更し、この列を設定することで、それを完全に無効にすることができ、水平スクロールバーを必要としません。あなたの最初の回避策は、私がやってきたことです、それは完全に表示されませんが、それは私が見つけた最高のソリューションです。 – Andrew