Java Code Examples for javax.swing.BoundedRangeModel#addChangeListener()

The following examples show how to use javax.swing.BoundedRangeModel#addChangeListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InstanceNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static ChangeListener setProgress(final ProgressHandle pHandle) {
    final BoundedRangeModel progress = HeapProgress.getProgress();
    ChangeListener cl = new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            pHandle.progress(progress.getValue());
        }
    };
    progress.addChangeListener(cl);
    return cl;
}
 
Example 2
Source File: HeapWalker.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static void setProgress(final ProgressHandle pHandle, final int offset) {
    final BoundedRangeModel progress = HeapProgress.getProgress();
    progress.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            pHandle.progress(progress.getValue()+offset);
        }
    });
}
 
Example 3
Source File: HeapFragment.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
public static void setProgress(final ProgressHandle pHandle, final int offset) {
    final BoundedRangeModel progress = HeapProgress.getProgress();
    progress.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            pHandle.progress(progress.getValue() + offset);
        }
    });
}
 
Example 4
Source File: InstanceNode.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private static ChangeListener setProgress(final ProgressHandle pHandle) {
    final BoundedRangeModel progress = HeapProgress.getProgress();
    ChangeListener cl = new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            pHandle.progress(progress.getValue());
        }
    };
    progress.addChangeListener(cl);
    return cl;
}
 
Example 5
Source File: HeapWalker.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private static void setProgress(final ProgressHandle pHandle, final int offset) {
    final BoundedRangeModel progress = HeapProgress.getProgress();
    progress.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            pHandle.progress(progress.getValue()+offset);
        }
    });
}
 
Example 6
Source File: PenWidth.java    From zxpoly with GNU General Public License v3.0 5 votes vote down vote up
public void setModel(final BoundedRangeModel model) {
  final BoundedRangeModel prev = this.currentModel.getAndSet(model);
  if (prev != null) {
    prev.removeChangeListener(this.changeListener);
  }
  if (model == null) {
    this.widthSlider.setPaintTicks(false);
  } else {
    this.widthSlider.setModel(model);
    this.widthSlider.setPaintTicks(true);
    model.addChangeListener(this.changeListener);
  }
  updateLookForCurrentModel();
}
 
Example 7
Source File: RotaryController.java    From jsyn with Apache License 2.0 5 votes vote down vote up
public RotaryController(BoundedRangeModel model) {
    this.model = model;
    setMinimumSize(new Dimension(50, 50));
    setPreferredSize(new Dimension(50, 50));
    addMouseListener(new MouseHandler());
    addMouseMotionListener(new MouseMotionHandler());
    model.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            safeRepaint();
        }

    });
}
 
Example 8
Source File: BoundedRangeModel2DocumentAdapter.java    From blog with Apache License 2.0 5 votes vote down vote up
public void bind(BoundedRangeModel boundedRangeModel) {
	if (this.boundedRangeModel != null) {
		this.boundedRangeModel.removeChangeListener(changeListenerAdapter);
	}
	this.boundedRangeModel = boundedRangeModel;
	if (boundedRangeModel != null) {
		boundedRangeModel.addChangeListener(changeListenerAdapter);
		ChangeEvent modelChangedEvent = new ChangeEvent(boundedRangeModel);
		changeListenerAdapter.stateChanged(modelChangedEvent);
	}
}
 
Example 9
Source File: RotaryController.java    From jsyn with Apache License 2.0 5 votes vote down vote up
public RotaryController(BoundedRangeModel model) {
    this.model = model;
    setMinimumSize(new Dimension(50, 50));
    setPreferredSize(new Dimension(50, 50));
    addMouseListener(new MouseHandler());
    addMouseMotionListener(new MouseMotionHandler());
    model.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            safeRepaint();
        }

    });
}