A perfect java blog

Masking in Javafx 2.0

Hello , Today I’m going to show the small demo of masking. In javafx masking is known as clipping. Every Node Object has

1

publicfinalvoid<strong>setClip</strong>(<atitle="class in javafx.scene">Node</a>value)

You can use the setClip to any Node.The setClip is used to mask for specific dimension of the existing Node.Let’s see the demo application of this masking in Detective Glass Application.
Source Code (DetectiveGlass.java):

1) First, you copy the SUN_JAVAFX.CAB file over to the device emulator file system
2) Click on the SUN_JAVAFX.CAB to install it
3) Copy the JavaFX application jar file over to the device emulator file system
4) Click on the jar file – this should start the JavaFX application installer and should ask you if you want to install the application
5) Once the installation finishes you can start JavaFX by choosing the “JavaFX” icon in the “Programs” section of the device
6) You should see your JavaFX application in the list of installed applications. Click to run it. Tesla Secret

Is there a way to create masking with complex shapes? What I have is an image of the back side of an iphone device and I’d like to create a “skin” for it using a photo but leaving the Apple logo as is (meaning not covered). Is there a way to achieve this if javaFX?

@Stefanos,
You can easily make use of “clipProperty” available for every Node . To make masking for the apple logo you need to make ImageView instance which will be shown to the user masking in the shape of applet logo.
imageToDisplay.setClip();