Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8751783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:06:48+00:00 2026-06-13T13:06:48+00:00

how to spin line (rotating 360 degree) in java fx? here the code :

  • 0

how to spin line (rotating 360 degree) in java fx? here the code :

package javafxapplication1;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.shape.Ellipse;
import javafx.scene.shape.EllipseBuilder;
import javafx.scene.shape.LineTo;
import javafx.scene.shape.MoveTo;
import javafx.scene.shape.Path;
import javafx.stage.Stage;
import javafx.scene.transform.Transform;

public class JavaFXApplication1 extends Application { 
  public static void main(String[] args) {
    launch(args);
}



@Override
public void start(Stage primaryStage) {
  Group root = new Group();
  Scene scene = new Scene(root, 800, 600, Color.WHITE);

  Ellipse lingkaran = EllipseBuilder.create()
    .centerX(400)
    .centerY(300)
    .radiusX(210)
    .radiusY(210)   
    .strokeWidth(3)
    .stroke(Color.BLACK)
    .fill(Color.WHITE)
    .build();

  Path path = new Path();
  MoveTo moveTo = new MoveTo();
  moveTo.setX(400);
  moveTo.setY(300);

  LineTo lineTo = new LineTo();
  lineTo.setX(400);
  lineTo.setY(100);

  path.getElements().add(moveTo);
  path.getElements().add(lineTo);
  path.setStrokeWidth(5);
  path.setStroke(Color.BLACK);

  root.getChildren().add(lingkaran);
  root.getChildren().add(path);

  primaryStage.setScene(scene);
  primaryStage.show();
  }
}

i want to spin the line 360 degree, but i don’t know how to do it. I have been looking for this in google but i never found the solution. Can somebody help me please?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:06:49+00:00Added an answer on June 13, 2026 at 1:06 pm

    You could rotate your circle and line with:

    root.getChildren().add(lingkaran);
    root.getChildren().add(path);
    
    RotateTransition rot = RotateTransitionBuilder.create().node(root)
        .byAngle(360).duration(new Duration(3000)).build();
    rot.play();
    
    primaryStage.setScene(scene);
    primaryStage.show();
    

    If you want to rotate only the line, replace .node(root) with .node(path).. If you don’t want to use an animation you may set the rotation property of the line.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just discovered the great plyr package and am taking it for a spin.
I've created a scene with textured and meshed cylinder and a grid with line
I've created a scene with textured and meshed cylinder and a grid with line
Explanation at the end of the code Java: void GetNextQuestion() { QuestNum++; /// ERROR
I'm trying to spin a TextBlock 360 degrees whenever it's binding updates. From everything
I'm working on a Clojure algorithm to solve the problem posed here: http://spin.atomicobject.com/2011/05/31/use-clojure-to-move-drugs-a-programming-challenge/ and
I'm using spin.js ( http://fgnass.github.com/spin.js/ ) while a large full width/height image loads. The
I need to find a way to spin off a thread from a static
I'm modeling an algorithm in Spin. I have a process that has several channels
I have a website that includes a few loading Gifs that spin while certain

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.