Table of contents
1.
Introduction
1.1.
Properties
1.2.
Constructors
2.
Examples of JavaFX GaussianBlur Implementation
3.
Frequently Asked Questions
3.1.
What is the function of ActionEvent in Java?
3.2.
What does the lambda expression in JavaFX mean?
3.3.
What is the JavaFX inset?
4.
Conclusion
Last Updated: Mar 27, 2024
Medium

JavaFX GaussianBlur

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

Introduction

The JavaFX GaussianBlur Effect is very similar to the JavaFX BoxBlur Effect. The only difference between the two is that the GaussianBlur effect blurs the nodes using a Gaussian convolution kernel. To implement GaussianBlur on the nodes, JavaFX provides the class javafx.scene.effect.GaussianBlur. This class is instantiated in order to have an effect on the node.

Properties

The following table describes the class's properties as well as the setter methods.

🔥 Property 
    → Description
    → Setter Methods
 

🔥 input

This is an effect property. It represents the effect's input.

setInput(Effect value)

 

🔥 radius

This property has two types. It represents the blur kernel's radius.

setRadius(Double value)

Constructors

There are two constructors in the class.

🌻 public GaussianBlur() :creates a new instance with the default parameter values.

🌻 public GaussianBlur(double radius): This creates a new instance with the parameters specified.

Examples of JavaFX GaussianBlur Implementation

package application;  
import javafx.scene.Group;
import javafx.application.Application;  
import javafx.scene.effect.BoxBlur;
import javafx.scene.Scene;  
import javafx.scene.paint.Color;   
import javafx.scene.effect.GaussianBlur;  
import javafx.scene.text.FontPosture;
import javafx.scene.text.Font;  
import javafx.stage.Stage;
import javafx.scene.text.Text;   
import javafx.scene.text.FontWeight;  
  
public class GaussianBlureg extends Application{  
    
    public void start(Stage primaryStage) throws Exception {  
        
        Text message = new Text();  
         message .setText("Welcome");  
         message setX(100);  
         message .setY(100);  
         message.setFont(Font.font("Calibri",FontWeight.BLACK,FontPosture.ITALIC,20));  
         message .setFill(Color.RED);  
         message .setStroke(Color.BLACK);  
         message .setUnderline(true);  
         GaussianBlur g = new GaussianBlur();  
         g.setRadius(5);  
         text.setEffect(g);  
         Group root = new Group();  
         root.getChildren().add(text);  
         Scene scene = new Scene(root,450,200);  
         primaryStage.setScene(scene);  
         primaryStage.setTitle("GaussianBlur Example");  
         primaryStage.show();  
    }  
public static void main(String[] args) {  
    launch(args);  
}  
}  
You can also try this code with Online Java Compiler
Run Code

 

Output
GaussianBlur Example

Frequently Asked Questions

FAQs

What is the function of ActionEvent in Java?

Java makes use of ActionEvent. To handle the actionPerformed event, awt calls the actionPerformed methods on listeners-a and listener-b. It notifies any registered ActionListener objects of any action events that occur on this object.

What does the lambda expression in JavaFX mean?

Using a lambda expression, you can create an anonymous class that implements a specific functional interface with only one abstract method. The EventHandler interface has only one abstract method, handle, which is used to manage JavaFX events.

What is the JavaFX inset?

The JavaFX Insets class is a component. The Insets class stores the interior offsets for each of the four sides of the rectangular region. The Insets class is based on Java.

Conclusion

In this article, we have extensively discussed the concepts of JavaFX GaussianBlur. We started with introducing the JavaFx GaussianBlur, constructors of JavaFX GaussianBlur, and methods of JavaFX GaussianBlur, then concluded with JavaFX GaussianBlur implementation.

We hope that this blog has helped you enhance your knowledge regarding JavaFX GaussianBlur, and if you would like to learn about JavaFX, you can learn from JavaFXJavaFX Fill transitionJavaFX Scale Transition, JavaFX rotate transition, etc.

You can also refer to our Guided Path on Coding Ninjas Studio to upskill yourself in Data Structures and AlgorithmsCompetitive ProgrammingSystem Design, and many more! You may also check out the mock test series and participate in the contests hosted on Coding Ninjas Studio! For placement preparations, you must look at the problemsinterview experiences, and interview bundle.

Nevertheless, you may consider our paid courses to give your career an edge over others!

Happy Coding!

Live masterclass