I want to print tableview with header and footer but i hadn't found any code in javafx to print a table with header and footer so please if any one knows how to print a table so please help me.
Thank you.
Use a BorderPane with the Table as Center element and the header and footer element as Top and Bottom element, respectively.
Super simple example application:
package application;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.scene.control.Label;
import javafx.scene.control.TableView;
public class Main extends Application {
@Override
public void start(Stage primaryStage) {
TableView table = new TableView();
//Do stuff with your table...
BorderPane root = new BorderPane();
root.setTop(new Label("Awesome header text.")); //Set header
root.setCenter(table); //add your table
root.setBottom(new Label("Even more awesome footer text.")); //Set footer
Scene scene = new Scene(root);
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
If you literally want to print it on a sheet of paper, follow the link already provided by ItachiUchiha .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.