List of usage examples for javax.swing JProgressBar updateUI
public void updateUI()
From source file:io.gameover.utilities.pixeleditor.Pixelizer.java
public JProgressBar getToleranceBar() { if (toleranceBar == null) { toleranceBar = new JProgressBar(); toleranceBar.setPreferredSize(new Dimension(200, 25)); toleranceBar.setValue(10);/*w ww. jav a2 s . com*/ toleranceBar.setMaximum(100); toleranceBar.setStringPainted(true); toleranceBar.addMouseListener(new MouseAdapter() { public boolean mouseEntered = false; @Override public void mouseReleased(MouseEvent e) { if (mouseEntered) { JProgressBar pb = (JProgressBar) e.getComponent(); pb.setValue((int) ((((double) e.getX()) / pb.getSize().getWidth()) * 100d)); pb.updateUI(); } } @Override public void mouseEntered(MouseEvent e) { this.mouseEntered = true; } @Override public void mouseExited(MouseEvent e) { this.mouseEntered = false; } }); } return toleranceBar; }