Search in sources :

Example 1 with BoundedRangeModel

use of javax.swing.BoundedRangeModel in project jvm-tools by aragozin.

the class HeapProgress method progress.

private static void progress(final long value, final long endOffset, final long startOffset) {
    BoundedRangeModel model = (BoundedRangeModel) progressThreadLocal.get();
    if (model != null) {
        long val = PROGRESS_MAX * (value - startOffset) / (endOffset - startOffset);
        setValue(model, (int) val);
    }
}
Also used : BoundedRangeModel(javax.swing.BoundedRangeModel) DefaultBoundedRangeModel(javax.swing.DefaultBoundedRangeModel)

Example 2 with BoundedRangeModel

use of javax.swing.BoundedRangeModel in project JMRI by JMRI.

the class DecVarSlider method stateChanged.

@Override
public void stateChanged(ChangeEvent e) {
    // called for new values of a slider - set the variable value as needed
    // e.getSource() points to the JSlider object - find it in the list
    JSlider j = (JSlider) e.getSource();
    BoundedRangeModel r = j.getModel();
    _var.setIntValue(r.getValue());
    _var.setState(AbstractValue.EDITED);
}
Also used : BoundedRangeModel(javax.swing.BoundedRangeModel) DefaultBoundedRangeModel(javax.swing.DefaultBoundedRangeModel) JSlider(javax.swing.JSlider)

Example 3 with BoundedRangeModel

use of javax.swing.BoundedRangeModel in project JMRI by JMRI.

the class IndexedPairVarSlider method stateChanged.

@Override
public void stateChanged(ChangeEvent e) {
    // called for new values of a slider - set the variable value as needed
    // e.getSource() points to the JSlider object - find it in the list
    JSlider j = (JSlider) e.getSource();
    BoundedRangeModel r = j.getModel();
    _iVar.setIntValue(r.getValue());
    _iVar.setState(AbstractValue.EDITED);
}
Also used : BoundedRangeModel(javax.swing.BoundedRangeModel) DefaultBoundedRangeModel(javax.swing.DefaultBoundedRangeModel) JSlider(javax.swing.JSlider)

Example 4 with BoundedRangeModel

use of javax.swing.BoundedRangeModel in project jvm-tools by aragozin.

the class HeapProgress method progressFinish.

static void progressFinish() {
    BoundedRangeModel model = (BoundedRangeModel) progressThreadLocal.get();
    if (model != null) {
        setValue(model, PROGRESS_MAX);
        progressThreadLocal.remove();
    }
}
Also used : BoundedRangeModel(javax.swing.BoundedRangeModel) DefaultBoundedRangeModel(javax.swing.DefaultBoundedRangeModel)

Example 5 with BoundedRangeModel

use of javax.swing.BoundedRangeModel in project jvm-tools by aragozin.

the class HeapProgress method getProgress.

public static BoundedRangeModel getProgress() {
    BoundedRangeModel model = (BoundedRangeModel) progressThreadLocal.get();
    if (model == null) {
        model = new DefaultBoundedRangeModel(0, 0, 0, PROGRESS_MAX);
        progressThreadLocal.set(model);
    }
    return model;
}
Also used : BoundedRangeModel(javax.swing.BoundedRangeModel) DefaultBoundedRangeModel(javax.swing.DefaultBoundedRangeModel) DefaultBoundedRangeModel(javax.swing.DefaultBoundedRangeModel)

Aggregations

BoundedRangeModel (javax.swing.BoundedRangeModel)7 DefaultBoundedRangeModel (javax.swing.DefaultBoundedRangeModel)7 JSlider (javax.swing.JSlider)4