' -fx-alignment: TOP_RIGHT' does not get honoured by table column header. Ideally the header would support all attributes of the CSS 'Labeled' class as per http://download.oracle.com/javafx/2.0/api/javafx/scene/doc-files/cssref.html#labeled
*** Code ***
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.layout.FlowPane;
import javafx.stage.Stage;
public class TestApp extends Application
{
public static void main(String[] args) throws Exception
{
launch(args);
}
public void start(Stage stage) throws Exception
{
FlowPane rootNode = new FlowPane();
TableView table = new TableView();
table.getColumns().add(new TableColumn("Column 1"));
table.getColumns().add(new TableColumn("Column 2"));
rootNode.getChildren().add(table);
Scene scene = new Scene(rootNode, 800, 600);
scene.getStylesheets().add("styles.css");
stage.setScene(scene);
stage.show();
}
}
*** CSS ***
.table-view .column-header {
-fx-border-color: red;
-fx-alignment: TOP_RIGHT;
}
When running this, the border gets applied (indicating the CSS selector works) and is around the full width of the header (indicating that the header is being sized correctly) but the header text stays centered.
Cheers,
zonski
*** Code ***
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.layout.FlowPane;
import javafx.stage.Stage;
public class TestApp extends Application
{
public static void main(String[] args) throws Exception
{
launch(args);
}
public void start(Stage stage) throws Exception
{
FlowPane rootNode = new FlowPane();
TableView table = new TableView();
table.getColumns().add(new TableColumn("Column 1"));
table.getColumns().add(new TableColumn("Column 2"));
rootNode.getChildren().add(table);
Scene scene = new Scene(rootNode, 800, 600);
scene.getStylesheets().add("styles.css");
stage.setScene(scene);
stage.show();
}
}
*** CSS ***
.table-view .column-header {
-fx-border-color: red;
-fx-alignment: TOP_RIGHT;
}
When running this, the border gets applied (indicating the CSS selector works) and is around the full width of the header (indicating that the header is being sized correctly) but the header text stays centered.
Cheers,
zonski