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 672623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:30:18+00:00 2026-05-14T00:30:18+00:00

I have a progress bar which inherits from JSlider to provide highlighting functionality. Highlights

  • 0

I have a progress bar which inherits from JSlider to provide highlighting functionality. Highlights can be added to the slider at a point (and a Color) and these are then painted onto the control. As follows:

http://img101.imageshack.us/img101/7608/sliderexample.png

The problem is that I cannot get the highlights in the right place, they need to be in the same location as the markers. I also do not know how to retrieve the left and right margins to where the markers start and end.

Is there anyway to get the coordinates of each marker? Or perhaps a better way of performing this task?

Many Thanks!

  • 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-05-14T00:30:18+00:00Added an answer on May 14, 2026 at 12:30 am

    This is dependent on the Look & Feel and there’s a good chance that there aren’t any markers at all when the user uses some non-standard L&F. In fact, your problem is both an extension of functionality and graphic realization so you may have to touch both, JSlider and SliderUI.

    Note the following methods:

    javax.swing.JSlider.getMajorTickSpacing() 
    javax.swing.JSlider.getMinorTickSpacing() 
    

    Also, it may help to look into javax.swing.plaf.SliderUI and the classes extending it, especially

    javax.swing.plaf.basic.BasicSliderUI.paintTicks(java.awt.Graphics)
    javax.swing.plaf.basic.BasicSliderUI.xPositionForValue(int)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a custom preference class which contains a simple progress bar in
I am designing a form in which I have to increase a Progress bar
I have this progress bar and I need to make the value depending on
I have implemented video play functionality in iphone.In which i am downloading video file
I have a WPF Linq-to-SQL project which I have been developing using MS Visual
I have a multi-threaded Cocoa app that processes images. The program has a progress
I am trying to create a thread that contains a form progress bar (just
I have a ProgressBar in MANUAL mode responding an URLLoader's progress events that seems
I have a classifieds website, and when posting a new ad, users may chose
I'm using the System.Diagnostics.Process class to execute a command line program. I am using

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.