Table of contents
1.
Introduction
2.
JavaFX Transformation
2.1.
Types of JavaFX Transformations
2.1.1.
Translation
2.1.2.
Rotation
2.1.3.
Scaling
2.2.
Multiple Transformations
2.2.1.
Implementation in Java
3.
Frequently Asked Questions
3.1.
Mention some features of JavaFX that make it different?
3.2.
Why should anybody choose JavaFX for application development?
3.3.
Under which type of license is JavaFX available?
4.
Conclusion
Last Updated: Aug 13, 2025
Easy

Introduction to JavaFX Transformation

Author Rupal Saluja
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

JavaFX is an open-source platform for desktop, mobile, and embedded systems whose goal is to take client experience to the next generation. It is the result of the efforts made by many individuals and companies with the aim to produce an efficient, modern, and fully featured toolkit facilitating the development of rich client applications. In this blog, we will try to make you understand JavaFX transformations that are in-built, in detail.

JavaFX Transformation

By the word Transformation, we understand that it is a change in form, nature or appearance of the graphics. These changes are done keeping some rules in reference. The JavaFX Transformation enables us to perform transformations such as translation, rotation, and scaling on Java FX nodes attached to the JavaFX graph screen. All these JavaFX transformations are done using different classes belonging to the same package, that is their parent class, javafx.scene.transform. In this blog, we will take a closer look at these transformations and their implementation using Java.

Types of JavaFX Transformations

We already learned that certain in-built transformations allowed in JavaFX are Translation, Rotation, and Scaling. To know more about these JavaFX transformations and for a clearer understanding, refer to the descriptions below.

Translation

When we say Translation, it means to displace. Translation in JavaFX is used to relocate or change the position of any node present in the graph screen. The class used to represent translation is javafx.scene.transform.Translate in which javafx.scene.transform is the parent class. You can use the images below for a better understanding.

This shows the image in original form, that is, before translation.

Before Translation

This shows the image in edited form, that is, after translation.

After Translation

From the images, we could imagine that how actually performing translation would look like. The image has been translated to a new position. 

Rotation

When we say Rotation, it means to turn the object from its origin. Rotation in JavaFX is used for the same, that is, to rotate any object by a certain angle present in the graph screen. The class used to represent translation is javafx.scene.transform.Rotate  in which javafx.scene.transform is the parent class. You can refer to the images below for a better understanding.

This shows the image in original form, that is, before rotation.

Before Rotation

This shows the image in edited form, that is, after translation.

After Rotation

 

From the images, we could imagine that how actually performing rotation would look like. The image has been rotated around a pivot point. 

Scaling

When we say Scaling, it means to either increase or decrease the size. Scaling in JavaFX is used to change the size of any object present in the graph screen, that is, either to scale up or scale down. The class used to represent translation is javafx.scene.transform.Scale in which javafx.scene.transform is the parent class. You can refer to the images below for a better understanding.

This shows the image in original form, that is, before scaling.

Before Scaling

This shows the image in edited form, that is, after scaling

After Scaling down

From the images, we could imagine that how actually performing scaling would look like. The image has been scaled down.

Multiple Transformations

You can apply multiple in-built transformations such as Translation, Rotation, and Scaling on nodes in JavaFX simultaneously. The following implementation of various transformations in Java shows how these transformations are performed in a Rectangle. You can refer to the images below for a better understanding.

This shows the image in original form, that is, before multiple transformations.

Before Transformations

This shows the image in edited form, that is, after transformations.

After Transformations

From the images, we could imagine that how actually performing multiple transformations would look like. The image has been translated, rotated, and scaled-down simultaneously.

Implementation in Java

import javafx.application.Application; 
import javafx.scene.Group; 
import javafx.scene.Scene; 
import javafx.scene.paint.Color; 
import javafx.scene.shape.Rectangle; 
import javafx.scene.transform.Rotate; 
import javafx.scene.transform.Scale; 
import javafx.scene.transform.Translate; 
import javafx.stage.Stage; 
         
public class MultipleTransformationsExample extends Application
{ 
   @Override 
   public void start(Stage stage)
   { 
      //Forming a Rectangle  
      Rectangle rectangle = new Rectangle(50, 50, 100, 75);
      rectangle.setFill(Color.BURLYWOOD); 
      rectangle.setStroke(Color.BLACK); 
       
      //performing Rotation
      Rotate rotate = new Rotate();
      rotate.setAngle(20);
      rotate.setPivotX(150); 
      rotate.setPivotY(225); 
       
      //performing Scaling 
      Scale scale = new Scale();
      scale.setX(1.5); 
      scale.setY(1.5);
      scale.setPivotX(300); 
      scale.setPivotY(135); 
       
      //performing Translation 
      Translate translate = new Translate();
      translate.setX(250); 
      translate.setY(0); 
      translate.setZ(0); 
       
      //Adding all the transformations
      rectangle.getTransforms().addAll(rotate, scale, translate);  
      Group root = new Group(rectangle); 
      Scene scene = new Scene(root, 600, 300);  
      stage.setTitle("Multiple transformations");
      stage.setScene(scene); 
      stage.show(); 
   }      
   public static void main(String args[]){ 
      launch(args); 
   } 
}

 

Output:

On executing the implementation above, we get the output image as:

The image shows the image created with the implementation of the above code.

Frequently Asked Questions

Mention some features of JavaFX that make it different?

To learn about some unique features of JavaFX, refer to the list below.

  • JavaFX Scene Builder for visualization.
  • New Media Engine for enhanced media playback.
  • Multi-touch support.
  • It provides over 60 UI controls and charts for CSS styling.
  • New Hardware acceleration.
     

Why should anybody choose JavaFX for application development?

The reasons to choose JavaFX over other software for application development are mentioned below.

  • Creation without boundaries with a rich set of graphics and Media APIs.
  • Familiarity with Java development tools.
  • Deployment either on the desktop or on the browser.
  • Java Libraries can be reused.
     

Under which type of license is JavaFX available?

JavaFX is available under the same license as well as the same business model as Java Standard Edition (SE). This allows the third-party developers for distribution of runtime libraries along with their applications, subject to the terms and conditions mentioned under the license.

Conclusion

In a nutshell, we understood what is JavaFX Transformation and learned about various in-built JavaFX Transformations. We also saw the code to implement multiple JavaFX Transformations simultaneously.

We hope the above discussion helped you understand JavaFX Transformations in clearer terms and can be used for future reference whenever needed. For a crystal understanding of JavaFX, you can refer to our blog on JavaFX. It is highly recommended to go through these blogs on Core JavaBasics of Java, and Java Data Structures and Algorithms before going deep into learning JavaFX.

Visit our website to read more such blogs. Make sure that you enroll in the courses provided by us, take mock tests and solve problems available and interview puzzles. Also, you can pay attention to interview stuff- interview experiences and an interview bundle for placement preparations. Do upvote our blog to help fellow ninjas grow.

Happy Coding!

Live masterclass