Call for New Batch / Any Query / Demo Classes : ☎ 08871209400 , 7987028543 , Zone-2,M.P.Nagar,Bhopal

JProgressBar Class in Java

A component that visually displays the progress of some task. As the task progresses towards completion, the progress bar displays the task's percentage of completion. This percentage is typically represented visually by a rectangle which starts out empty and gradually becomes filled in as the task progresses. In addition, the progress bar can display a textual representation of this percentage.

Syntax of JProgressBar

JProgressBar uses a BoundedRangeModel as its data model, with the value property representing the "current" state of the task, and the minimum and maximum properties representing the beginning and end points, respectively.

To indicate that a task of unknown length is executing, you can put a progress bar into indeterminate mode. While the bar is in indeterminate mode, it animates constantly to show that work is occurring. As soon as you can determine the task's length and amount of progress, you should update the progress bar's value and switch it back to determinate mode.

Here is an example of creating a progress bar, where task is an object (representing some piece of work) which returns information about the progress of the task:

progressBar = new JProgressBar(0, task.getLengthOfTask());

Here is an example of querying the current state of the task, and using the returned value to update the progress bar:


Here is an example of putting a progress bar into indeterminate mode, and then switching back to determinate mode once the length of the task is known:

progressBar = new JProgressBar();
...//when the task of (initially) unknown length begins:
...//do some work; get length of task...

Though Swing is not thread safe.

References : Oracle share on :        :  

Love to hear your Views / Guidance / Recommendations on this Post…

More Programming Topics

PrintStream Class in JavaA PrintStream adds functionality to another output stream, namely the ability to print representations of various data values conveniently.Anonymous Inner Classes in JavaAnonymous Inner Classes are defined in another expression.The syntax of an anonymous class expression is like the invocation of a constructor except that there is a class definition contained in a block of codeServlet Authentication FiltersA Servlet Authentication Filter is a provider type that performs pre and post processing for authentication functions including identity assertionservlet configure filtersYou configure filters as part of a Web application using the applications web.xml deployment descriptorAn Iteration TagIteration Tag extends the Tag interface and adds one more method for supporting iterationsA filter is an object that performs filtering tasksA filter is an object that performs filtering tasks on either the request to a resource or on the response from a resource or both.Life cycle of a servletThe lifecycle of a servlet is controlled by the container in which the servlet has been deployed.Custom Tags AttributesA simple tag can have attributes. Attributes customize the behavior of a custom tag just as parameters customize the behavior of a method.Unicode Computing Standard in JavaUnicode is a computing industry standard designed to consistently and uniquely encode characters used in written languages throughout the world

Explore the Technology World

Top Programing Index January 2018January Headline Programming Language C awarded Language of the Year 2017,language C appears to be the fastest grower of 2017 in the TIOBE index and thus is declared programming language of the yearProgramming languages used in most popular websitesThe most popular websites have in common that they are dynamic websites. Their development typically involves server side coding client side coding and database technologyTop 10 Computer Science Skills That Could Sharpen Non-Computer Science CareersWhat do design marketing, engineering and data analysis have in common Theyre all careers where employers increasingly demand computer science skills.Oracle Buys AconexCreates the Worlds Most Comprehensive Cloud Offering for Managing All Aspects of Construction ProjectsOracle Unveils Worlds First Autonomous Database CloudAlso Introduces Oracle Autonomous Data Warehouse Cloud that has Demonstrated Performance of 10x Faster at Half the Cost of AmazonRecent List and Rankings Of Top Programming LanguagesThe programming languages Kotlin and C seem to be the only candidates to become programming language of the year 2017. TIOBE will announce the winner of this award next month

Call / Visit for New Batch


Why Join Us

  • ➯ Free Demo Classes
  • ➯ No Registration Fee
  • ➯ Interview Questions
  • ➯ Study Materials
  • ➯ Softwares
  • ➯ Aptitude & Reasoning
  • ➯ Placement Assitance


  • MyJava Training Institute ,
  • Plot No.243 , shop No 14 ,
  • Secnd Floor , Zone-II ,
  • M.P.Nagar , Bhopal,
  • Madhya Pradesh ( 462011 )
  • ☎  08871209400 , 7987028543
  • 🌐
FacebookGoogle +LinkedInTwitterYouTube

MyJava - java Training Institute