Example usage for javax.swing JProgressBar putClientProperty

List of usage examples for javax.swing JProgressBar putClientProperty

Introduction

In this page you can find the example usage for javax.swing JProgressBar putClientProperty.

Prototype

public final void putClientProperty(Object key, Object value) 

Source Link

Document

Adds an arbitrary key/value "client property" to this component.

Usage

From source file:UI.MainViewPanel.java

public JProgressBar getPanel7(Metric7 m7) {

    JProgressBar openPortBar = new JProgressBar(0, 100);
    openPortBar.setValue(m7.totalCriticalCount);
    openPortBar.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    UIDefaults defaults = new UIDefaults();

    Painter foregroundPainter = new MyPainter(new Color(230, 219, 27));
    Painter backgroundPainter = new MyPainter(chartBackgroundColor);
    defaults.put("ProgressBar[Enabled].foregroundPainter", foregroundPainter);
    defaults.put("ProgressBar[Enabled+Finished].foregroundPainter", foregroundPainter);
    defaults.put("ProgressBar[Enabled].backgroundPainter", backgroundPainter);

    openPortBar.putClientProperty("Nimbus.Overrides.InheritDefaults", Boolean.TRUE);
    openPortBar.putClientProperty("Nimbus.Overrides", defaults);

    openPortBar.setString("" + m7.totalCriticalCount);
    openPortBar.setStringPainted(true);/*from  w  w w  .  ja  v  a2  s  .c  o  m*/

    return openPortBar;
}