All Downloads are FREE. Search and download functionalities are using the official Maven repository.

anlavn.ui.ProgressBar Maven / Gradle / Ivy

The newest version!
package anlavn.ui;
// Make By Bình An || AnLaVN || KatoVN

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Insets;
import javax.swing.JProgressBar;
import javax.swing.plaf.basic.BasicProgressBarUI;

/**The ProgressBar supports to export modern progress bar.
 * @author AnLaVN - https://github.com/AnLaVN
 */
public class ProgressBar extends JProgressBar {
    
    private Color colorString = new Color(200, 200, 200);
    
    /**Create modern Progress Bar.
     */
    public ProgressBar() {
        setStringPainted(true);
        setPreferredSize(new Dimension(100, 15));
        setBackground(new Color(255, 255, 255));
        setForeground(new Color(69, 124, 235));
        setUI(new BasicProgressBarUI() {
            @Override
            protected void paintString(Graphics grphcs, int i, int i1, int i2, int i3, int i4, Insets insets) {
                grphcs.setColor(getColorString());
                super.paintString(grphcs, i, i1, i2, i3, i4, insets);
            }
        });
    }
    
    public Color getColorString() {
        return colorString;
    }
    public void setColorString(Color colorString) {
        this.colorString = colorString;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy