Is there any Swing Star rating widget.. am thinking of implementing my own .. but finding one will save me so much time
Thank you
What about this one:
Star Rating Panel for Java Swing
Sample code to use the StarRater (using the example from the comments):
public class Test {
public static void main(String[] args) {
JFrame frame = new JFrame();
JPanel panel = new JPanel();
StarRater starRater = new StarRater(5, 2, 1);
starRater.addStarListener(
new StarRater.StarListener() {
public void handleSelection(int selection) {
System.out.println(selection);
}
});
panel.add(starRater);
frame.getContentPane().add(panel);
frame.pack();
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With