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

  • SEARCH
  • Home
  • 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 8185849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:59:38+00:00 2026-06-07T01:59:38+00:00

based on the volume knob from this example, http://fxexperience.com/2012/01/fun-javafx-2-0-audio-player/ How would you make a

  • 0

based on the volume knob from this example, http://fxexperience.com/2012/01/fun-javafx-2-0-audio-player/

How would you make a volume knob that snaps to particular angle value, every 15 or 30 degree for example ? Thanks for any hint.
What i did is redefine rotateKnob in subclass and set the angle in this manner for the slider to snap at values 180, 120, 60, 0, -180, -160, -120, -60 :

Slider s = getSkinnable();
    double zeroOneValue = (s.getValue() - s.getMin()) / (s.getMax() - s.getMin());
    double angle = minAngle + ((maxAngle - minAngle) * zeroOneValue);

    int angleMod = (int) (angle % 60);
    double val;
    if (angleMod == 0) {
        val = (int) angle;
    } else if (angleMod > (60 / 2)) {
        val = (int) angle - angleMod;
    } else {
        val = (int) angle - angleMod + 60;
    }
  • 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-07T01:59:40+00:00Added an answer on June 7, 2026 at 1:59 am

    You don’t need to do anything special. Just make use of the “snapToTicks” property. In the main class, after the volume knob is defined, put this code:

        volumeKnob.setMinorTickCount(0);
        volumeKnob.setMajorTickUnit(1.0/14.0);
        volumeKnob.snapToTicksProperty().set(true);
    

    The numbers here are based on the fact that there are 14 “dots” around the volume knob. This code will make sure that you can only set the volume to one of those dots.

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

Sidebar

Related Questions

I'm trying to write a basic toast example based on the volume buttons getting
My main goal is to change the volume on one sound card based on
Based on an answer from a candidate I have a confusion regarding the functioning
Based on the answer for this question What's the difference between CompositionBatch and catalogs?
Based on a configuration setting I'd like to direct users to a This site
Based on this article I was able to get the FullName to work rather
Based on this question I've created a small application which is catching all debug
This should be a code igniter based class, The table header should be Price
i would like to trigger an event sometime in the future based on an
Simple example to implement hive based registry? I have an appliaction in which i

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.