ApprovalRatingBar is a Java library that allows developers to add an approval rating bar component to a Java Swing application.
An ApprovalRatingBar component displays a bar with a custom number of markers to let the user choose a rating in a easy-to-read graphical way.
The component may be layed out horizontally (default) or vertically and the starting-point (the point from which the user sees the rating increase its value) can be placed at the left/right-most marker (for horizontal bars) or at the top/bottom marker (for vertical bars).
Developers can set the color for the markers and can choose between two types of markers: circle (default) or square. It is, also, possible to set a couple of custom images to use instead for markers rendering.
Let's see some examples.
This is the minimal example: it creates a standard horizontal ApprovalRatingBar with 7 standard blue markers and an initial value of 0:
ApprovalRatingBar bar = new ApprovalRatingBar(7);
If we add the 'bar' component to a container, this is what we'll see:
The number of markers is the only mandatory constructor parameter.
If we want to create an ApprovalRatingBar layed out vertically, we just use the two-parameters constructor:
ApprovalRatingBar bar = new ApprovalRatingBar(7, ApprovalRatingBar.VERTICAL);
And this is the result: