ヘッダーとフッターを付けてtableviewを印刷したいのですが、ヘッダーとフッターを付けてテーブルを印刷するためのコードがjavafxで見つかりませんでした。
ありがとうございました。
回答:
回答№1は0使う BorderPane TableをCenter要素として、headerおよびfooter要素をそれぞれTop要素およびBottom要素として使用します。
超簡単なサンプルアプリケーション
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);
}
}
文字通り一枚の紙に印刷したい場合は、 ItachiUchihaはすでに提供しています.