transition java fx
Java
import javafx.animation.TranslateTransition;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import javafx.util.Duration;
public class FxTransitionExample3 extends Application
{
public static void main(String[] args)
{
Application.launch(args);
}
@Override
public void start(Stage stage)
{
// Create the Text
Text text = new Text("A Translate Transition Example");
text.setFont(Font.font(36));
// Create the VBox
VBox root = new VBox(text);
// Set the Size of the VBox
root.setPrefSize(500, 100);
// Set the Style-properties of the VBox
root.setStyle("-fx-padding: 10;" +
"-fx-border-style: solid inside;" +
"-fx-border-width: 2;" +
"-fx-border-insets: 5;" +
"-fx-border-radius: 5;" +
"-fx-border-color: blue;");
// Create the Scene
Scene scene = new Scene(root);
// Add the Scene to the Stage
stage.setScene(scene);
// Set the Title
stage.setTitle("Scrolling Text using a Translate Transition");
// Display the Stage
stage.show();
// Set up a Translate Transition for the Text object
TranslateTransition trans = new TranslateTransition(Duration.seconds(2), text);
trans.setFromX(scene.getWidth());
trans.setToX(-1.0 * text.getLayoutBounds().getWidth());
// Let the animation run forever
trans.setCycleCount(TranslateTransition.INDEFINITE);
// Reverse direction on alternating cycles
trans.setAutoReverse(true);
// Play the Animation
trans.play();
}
}
import javafx.animation.FadeTransition;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
import javafx.util.Duration;
public class FxTransitionExample1 extends Application
{
public static void main(String[] args)
{
Application.launch(args);
}
@Override
public void start(Stage stage)
{
// Create a green Rectangle
Rectangle rect = new Rectangle(400, 200, Color.GREEN);
// Create the HBox
HBox root = new HBox(rect);
// Set the Style-properties of the HBox
root.setStyle("-fx-padding: 10;" +
"-fx-border-style: solid inside;" +
"-fx-border-width: 2;" +
"-fx-border-insets: 5;" +
"-fx-border-radius: 5;" +
"-fx-border-color: blue;");
// Create the Scene
Scene scene = new Scene(root);
// Add the Scene to the Stage
stage.setScene(scene);
// Set the Title of the Stage
stage.setTitle("A Fade-in and Fade-out Transition Example");
// Display the Stage
stage.show();
// Set up a fade-in and fade-out animation for the rectangle
FadeTransition trans = new FadeTransition(Duration.seconds(2), rect);
trans.setFromValue(1.0);
trans.setToValue(.20);
// Let the animation run forever
trans.setCycleCount(FadeTransition.INDEFINITE);
// Reverse direction on alternating cycles
trans.setAutoReverse(true);
// Play the Animation
trans.play();
}
}
Also in Java:
- Title
- generate all prime number less than n java (fastest method)
- Category
- Java
- Title
- insert element into arraylist java
- Category
- Java
- Title
- org.springframework.orm.jpa.EntityManagerHolder cannot be cast to org.springframework.orm.hibernate5.SessionHolder
- Category
- Java
- Title
- string to arraylist convert java
- Category
- Java
- Title
- java loop hashmap
- Category
- Java
- Title
- java remove double spaces
- Category
- Java
- Title
- guess the number java
- Category
- Java
- Title
- random code
- Category
- Java
- Title
- create color object java
- Category
- Java
- Title
- kotlin add value to MutableLiveData
- Category
- Java
- Title
- annotation spring notnull
- Category
- Java
- Title
- is self divisor java
- Category
- Java
- Title
- jbutton remove selection border
- Category
- Java
- Title
- java android development find element by id
- Category
- Java
- Title
- 2 decimal places print format JAVA
- Category
- Java
- Title
- java recursion
- Category
- Java
- Title
- osmdroid offline map does not show
- Category
- Java
- Title
- caesar cipher java
- Category
- Java
- Title
- read lines of file randomly java
- Category
- Java
- Title
- java manacher's algorithm
- Category
- Java
- Title
- casting java
- Category
- Java
- Title
- convert char to string java
- Category
- Java
- Title
- how to create an array with unique values
- Category
- Java
- Title
- java loop object
- Category
- Java
- Title
- iterate through hashmap in java
- Category
- Java
- Title
- jenkins decrypt password script console
- Category
- Java
- Title
- deleting elements of an array in java
- Category
- Java
- Title
- how to loop trough an object java script
- Category
- Java
- Title
- java how to print a newline
- Category
- Java
- Title
- intellij set target bytecode version
- Category
- Java
- Title
- how to replace in java
- Category
- Java
- Title
- difference between compile and execute in java
- Category
- Java
- Title
- java get environment variables
- Category
- Java
- Title
- java random numbers in specific range
- Category
- Java
- Title
- how to use spring in java
- Category
- Java
- Title
- java random boolean
- Category
- Java
- Title
- how to create an array in java
- Category
- Java
- Title
- how to remove all whitespace from string java
- Category
- Java
- Title
- check if list contains new line in java
- Category
- Java
- Title
- how to do substring java
- Category
- Java
- Title
- NumSelfDivisors java
- Category
- Java
- Title
- stack overflow recyclerview
- Category
- Java
- Title
- how to import a scanner in java
- Category
- Java
- Title
- how to fill a list with a single value java
- Category
- Java
- Title
- java string reverse
- Category
- Java
- Title
- applicationcontext.xml
- Category
- Java
- Title
- java printf tab
- Category
- Java
- Title
- java startActivity crash
- Category
- Java
- Title
- java hashmap syntax
- Category
- Java
- Title
- sc.nextline skips
- Category
- Java
- Title
- try block in java
- Category
- Java
- Title
- add video in bootstrap
- Category
- Java
- Title
- print a list java
- Category
- Java
- Title
- how to iterate list in java selenium
- Category
- Java
- Title
- queue implementation in java using arraylist
- Category
- Java
- Title
- java thread
- Category
- Java
- Title
- string method example in java
- Category
- Java
- Title
- how to open a text file in java
- Category
- Java
- Title
- how to add java_home in mac
- Category
- Java
- Title
- how to check if a list is empty java
- Category
- Java
- Title
- android get last crash adb
- Category
- Java
- Title
- create object of static class in java
- Category
- Java
- Title
- inheritance setter and getter in java
- Category
- Java
- Title
- tostring() java example
- Category
- Java
- Title
- full shutdown windows 10 cmd
- Category
- Java
- Title
- java swing draw centered text
- Category
- Java
- Title
- java break in foreach
- Category
- Java
- Title
- java 8 collect multiple lists into single list
- Category
- Java
- Title
- reverse linked list in java to get both head and tail
- Category
- Java
- Title
- java find if element of list in present in another list
- Category
- Java
- Title
- java iterate through map
- Category
- Java
- Title
- how to compare string in java
- Category
- Java
- Title
- alfred workflow
- Category
- Java
- Title
- simple javascript to detect browser using java utils
- Category
- Java
- Title
- java get current date without time
- Category
- Java
- Title
- change fab image programatically
- Category
- Java
- Title
- compareto method java
- Category
- Java
- Title
- how to get token oauth2.0 java example response
- Category
- Java
- Title
- jtable get get row
- Category
- Java
- Title
- java how to make a string lowercase
- Category
- Java
- Title
- java hashmap size
- Category
- Java
- Title
- java do while
- Category
- Java
- Title
- how to install java 8 in ubuntu 16.04
- Category
- Java
- Title
- how to echo java_home in windows cmd
- Category
- Java
- Title
- how to get elements of a list in java
- Category
- Java
- Title
- java script num toSting syntax eror
- Category
- Java
- Title
- programmation android avoir acces à la liste des intents de partage
- Category
- Java
- Title
- java output array lists to file
- Category
- Java
- Title
- get random number from enum in java
- Category
- Java
- Title
- change brightness of image in java
- Category
- Java
- Title
- java 8 add whole array to jsonarray
- Category
- Java
- Title
- java treeset
- Category
- Java
- Title
- primitive and non primitive data types in java
- Category
- Java
- Title
- java for loop add multiple declarations
- Category
- Java
- Title
- double round java integer
- Category
- Java
- Title
- java int to binary
- Category
- Java
- Title
- parse string to int java
- Category
- Java
- Title
- create instance object java
- Category
- Java
- Title
- convert array of int to arraylist java
- Category
- Java
- Title
- java string util if empty default
- Category
- Java