How to draw image rotated on JavaFX Canvas?

Here is a sample, following similar principles to Katona’s answer, only difference is that it rotates images about arbitrary pivot points by applying a custom transform. import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.canvas.*; import javafx.scene.image.Image; import javafx.scene.layout.StackPane; import javafx.scene.paint.Color; import javafx.scene.transform.Rotate; import javafx.stage.Stage; /** Rotates images round pivot points and places them in a … Read more

Animation upon layout changes

This is a really neat idea. I like this. You should consider contributing your new layout manager to jfxtras. Why your Originally Posted Solution Does not Work Your problem is the logic around trying to record an original value for the translateX/Y values and ending your translate transition at that original value. When a TranslateTransition … Read more

How do specify a width percentage in JavaFX 2 using FXML?

I’m not sure you can. You need to use the GridPane layout component. In this component, you can specify rows and columns constraints, and in these constraints you can specify a width as a percentage. For example: <GridPane> <children> <TitledPane text=”testGridPane” GridPane.columnIndex=”0″ GridPane.rowIndex=”0″ /> </children> <columnConstraints> <ColumnConstraints hgrow=”SOMETIMES” minWidth=”10.0″ percentWidth=”80.0″ prefWidth=”100.0″ /> <ColumnConstraints hgrow=”SOMETIMES” minWidth=”10.0″ … Read more

How to scroll to make a Node within the content of a ScrollPane visible?

EDIT: code in the next example is more precise than mine: You need to find a coordinates of this inner node inside content and adjust ScrollPane‘s vValue and hValue accordingly. See ensureVisible() method in next small app: public class ScrollPaneEnsureVisible extends Application { private static final Random random = new Random(); private static void … Read more

How to set specific color to JavaFX XYChart.Series?

In general the way preferred way to style charts is without code, using only css stylesheets as jschoen recommends. Additionally, if further customization is required, you can use css lookups from code to dig into the the nodes generated from series data and apply various additional css styling. Here is information about dynamically changing a … Read more

Moving an undecorated stage in javafx 2

I created a sample of an animated clock in an undecorated window which you can drag around. Relevant code from the sample is: // allow the clock background to be used to drag the clock around. final Delta dragDelta = new Delta(); layout.setOnMousePressed(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { // record a delta … Read more

Auto fit size column in table view

After 3 years I come back to this problem again, some suggestions are calculating the size of text of data in each cell (it’s complicated depending on font size, font family, padding…) But I realize that when I click on the divider on table header, it’s resized fit to content as I want. So I … Read more