Untitled

 avatar
unknown
plain_text
2 months ago
2.1 kB
1
Indexable
import javafx.animation.ScaleTransition;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.stage.Stage;
import javafx.util.Duration;

public class CreativeDesign extends Application {

    @Override
    public void start(Stage primaryStage) {
        // Create buttons
        Button button1 = createButton("اے آئی گائیڈز");
        Button button2 = createButton("ہمارے یوٹیوب چینل پر ویڈیوز دیکھیں");
        Button button3 = createButton("ہمارا فیس بک گروپ جوائن کریں");

        // Add buttons to layout
        HBox layout = new HBox(20, button1, button2, button3);
        layout.setStyle("-fx-background-color: linear-gradient(to bottom, #ffffff, #cce7ff); -fx-padding: 50px;");

        // Create scene and add to stage
        Scene scene = new Scene(layout, 800, 200);
        primaryStage.setScene(scene);
        primaryStage.setTitle("Creative Design with Animation");
        primaryStage.show();
    }

    private Button createButton(String text) {
        Button button = new Button(text);
        button.setFont(new Font("Arial", 16));
        button.setTextFill(Color.WHITE);
        button.setStyle(
            "-fx-background-color: linear-gradient(to bottom, #4a90e2, #0066cc); " +
            "-fx-background-radius: 10; -fx-padding: 10px 20px;"
        );

        // Add hover animation
        ScaleTransition scaleTransition = new ScaleTransition(Duration.millis(200), button);
        button.setOnMouseEntered(e -> {
            scaleTransition.setToX(1.1);
            scaleTransition.setToY(1.1);
            scaleTransition.play();
        });
        button.setOnMouseExited(e -> {
            scaleTransition.setToX(1);
            scaleTransition.setToY(1);
            scaleTransition.play();
        });

        return button;
    }

    public static void main(String[] args) {
        launch(args);
    }
}
Editor is loading...
Leave a Comment