FULL PRODUCT VERSION :
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 10 Pro
A DESCRIPTION OF THE PROBLEM :
When adding a lot of columns (> 100) to my TreeTableView, the scrollbar is calculated wrong and cutting of the last column. I created a SO-Questions and it seems to be solved in Java9 ea. But I would need this working in Java8 for my customer.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeTableColumn;
import javafx.scene.control.TreeTableView;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class TreeTableViewScroll extends Application {
public static void main(final String[] args) {
launch(args);
}
@Override
public void start(final Stage primaryStage) throws Exception {
final Scene scene = createScene();
primaryStage.setTitle("Tree Table View Scroll");
primaryStage.setScene(scene);
primaryStage.show();
}
private Scene createScene() {
final VBox vBox = new VBox();
vBox.setPadding(new Insets(5));
vBox.setSpacing(5);
final TreeTableView<String> resultsTable = new TreeTableView<>();
resultsTable.setShowRoot(false);
final TreeItem<String> rootItem = new TreeItem<>();
resultsTable.setRoot(rootItem);
for (int i = 0; i < 200; i++) {
final TreeTableColumn<String, String> dummyColumn = new TreeTableColumn<>("Long Column name " + i);
resultsTable.getColumns().add(dummyColumn);
}
final TreeTableColumn<String, String> nameColumn = new TreeTableColumn<>("Name_very long column text");
resultsTable.getColumns().add(nameColumn);
vBox.getChildren().setAll(resultsTable);
VBox.setVgrow(resultsTable, Priority.ALWAYS);
vBox.setPrefSize(800, 600);
for (int i = 0; i < 50; i++) {
final TreeItem<String> newItem = new TreeItem<>("Text " + i);
rootItem.getChildren().add(newItem);
newItem.getChildren().add(new TreeItem<>("Text " + i));
}
return new Scene(vBox);
}
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
http://stackoverflow.com/questions/43520674/javafx-treetableview-calculating-scrollbar-wrong/43523995#43523995
Both the actual and expected results are shown there as images (did find a way to add them here - so I simple put the so-link here).
REPRODUCIBILITY :
This bug can be reproduced always.
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 10 Pro
A DESCRIPTION OF THE PROBLEM :
When adding a lot of columns (> 100) to my TreeTableView, the scrollbar is calculated wrong and cutting of the last column. I created a SO-Questions and it seems to be solved in Java9 ea. But I would need this working in Java8 for my customer.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeTableColumn;
import javafx.scene.control.TreeTableView;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class TreeTableViewScroll extends Application {
public static void main(final String[] args) {
launch(args);
}
@Override
public void start(final Stage primaryStage) throws Exception {
final Scene scene = createScene();
primaryStage.setTitle("Tree Table View Scroll");
primaryStage.setScene(scene);
primaryStage.show();
}
private Scene createScene() {
final VBox vBox = new VBox();
vBox.setPadding(new Insets(5));
vBox.setSpacing(5);
final TreeTableView<String> resultsTable = new TreeTableView<>();
resultsTable.setShowRoot(false);
final TreeItem<String> rootItem = new TreeItem<>();
resultsTable.setRoot(rootItem);
for (int i = 0; i < 200; i++) {
final TreeTableColumn<String, String> dummyColumn = new TreeTableColumn<>("Long Column name " + i);
resultsTable.getColumns().add(dummyColumn);
}
final TreeTableColumn<String, String> nameColumn = new TreeTableColumn<>("Name_very long column text");
resultsTable.getColumns().add(nameColumn);
vBox.getChildren().setAll(resultsTable);
VBox.setVgrow(resultsTable, Priority.ALWAYS);
vBox.setPrefSize(800, 600);
for (int i = 0; i < 50; i++) {
final TreeItem<String> newItem = new TreeItem<>("Text " + i);
rootItem.getChildren().add(newItem);
newItem.getChildren().add(new TreeItem<>("Text " + i));
}
return new Scene(vBox);
}
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
http://stackoverflow.com/questions/43520674/javafx-treetableview-calculating-scrollbar-wrong/43523995#43523995
Both the actual and expected results are shown there as images (did find a way to add them here - so I simple put the so-link here).
REPRODUCIBILITY :
This bug can be reproduced always.
- duplicates
-
JDK-8163943 TableView, TableColumn, scrollBar with horizontal orientation
-
- Resolved
-