當前位置: 首頁>>代碼示例>>Java>>正文


Java BoundedRangeModel.addChangeListener方法代碼示例

本文整理匯總了Java中javax.swing.BoundedRangeModel.addChangeListener方法的典型用法代碼示例。如果您正苦於以下問題:Java BoundedRangeModel.addChangeListener方法的具體用法?Java BoundedRangeModel.addChangeListener怎麽用?Java BoundedRangeModel.addChangeListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.BoundedRangeModel的用法示例。


在下文中一共展示了BoundedRangeModel.addChangeListener方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createSlider

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
private JSlider createSlider(String title, final BoundedRangeModel model, JPanel p, GridBagConstraints gbc, final Runnable runnable) {
    gbc.gridy++;
    gbc.gridx = 0;
    JLabel titleLabel = new JLabel(title);
    p.add(titleLabel, gbc);
    gbc.gridx = 1;
    JSlider slider = new JSlider(model);
    p.add(slider, gbc);
    if (runnable != null) {
        model.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent event) {
                jobs.add(runnable);
            }
        });
    }
    return slider;
}
 
開發者ID:geralddejong,項目名稱:darwinathome,代碼行數:18,代碼來源:TensegrityDemo.java

示例2: propertyChange

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
public void propertyChange(final PropertyChangeEvent e) {
    String propertyName = e.getPropertyName();
    if (StringConstants.MODEL_PROPERTY_CHANGED.equals(propertyName)) {
        BoundedRangeModel oldValue = (BoundedRangeModel)e.getOldValue();
        if (oldValue != null) {
            oldValue.removeChangeListener(hsbChangeListener);
        }

        BoundedRangeModel newValue = (BoundedRangeModel)e.getNewValue();
        if (newValue != null) {
            newValue.addChangeListener(hsbChangeListener);
        }
    } else if (StringConstants.COMPONENT_ORIENTATION.equals(propertyName)) {
        hsbChangeListener.stateChanged(new ChangeEvent(e.getSource()));
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:17,代碼來源:BasicScrollPaneUI.java

示例3: propertyChange

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
public void propertyChange(final PropertyChangeEvent e) {
       String propertyName = e.getPropertyName();
       if (StringConstants.COMPONENT_ORIENTATION.equals(propertyName)) {
           uninstallKeyboardActions();
           installKeyboardActions();
       } else if (StringConstants.MODEL_PROPERTY_CHANGED.equals(propertyName)) {
           BoundedRangeModel oldValue = (BoundedRangeModel)e.getOldValue();
           if (oldValue != null) {
               oldValue.removeChangeListener(modelListener);
           }

           BoundedRangeModel newValue = (BoundedRangeModel)e.getNewValue();
           if (newValue != null) {
               newValue.addChangeListener(modelListener);
           }
       }

if (scrollbar != null) {	
           scrollbar.revalidate();
           scrollbar.repaint();
       }
   }
 
開發者ID:shannah,項目名稱:cn1,代碼行數:23,代碼來源:BasicScrollBarUI.java

示例4: setProgress

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:InstanceNode.java

示例5: setProgress

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
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);
        }
    });
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:HeapWalker.java

示例6: subscribeActual

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
@Override
protected void subscribeActual(Observer<? super ChangeEvent> observer) {
    BoundedRangeModel w = widget;

    ChangeEventConsumer aec = new ChangeEventConsumer(observer, w);
    observer.onSubscribe(aec);

    w.addChangeListener(aec);
    if (aec.get() == null) {
        aec.onDispose(w);
    }
}
 
開發者ID:akarnokd,項目名稱:RxJava2Swing,代碼行數:13,代碼來源:ChangeEventBoundedRangeObservable.java

示例7: setModel

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
/**
 * @param model
 */
public synchronized void setModel(final BoundedRangeModel model) {
    if (this.model == model) { return; }
    if (this.model != null) {
        model.removeChangeListener(changeListener);
    }
    changeListener = createChangeListener();
    model.addChangeListener(changeListener);
    this.model = model;

    this.repaint();

}
 
開發者ID:friedlwo,項目名稱:AppWoksUtils,代碼行數:16,代碼來源:CircledProgressBar.java

示例8: RotaryController

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
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) {
            repaint();
        }
    });
}
 
開發者ID:philburk,項目名稱:jsyn,代碼行數:14,代碼來源:RotaryController.java

示例9: setModel

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
protected void setModel(BoundedRangeModel model) {
	if (this.model != model) {
		if (this.model != null) {
			this.model.removeChangeListener(this);
		}
		this.model = model;
		if (model != null) {
			model.addChangeListener(this);
		}

		update(false);
	}
}
 
開發者ID:jedwards1211,項目名稱:breakout,代碼行數:14,代碼來源:JSliderValueBinder.java

示例10: VolumeSlider

import javax.swing.BoundedRangeModel; //導入方法依賴的package包/類
/**
 * 
 * Creates a new volume slider controlling the designated volume type (music or sound)
 * 
 * @param type
 * 		the sound type to control.
 * 
 * @param demo
 * 		the sound clip to play on each change. This clip represents an idea of how loud/soft the setting is
 * 
 */
public VolumeSlider(final SoundType type, final Clip demo) {
	super();
	

	final BoundedRangeModel model = new DefaultBoundedRangeModel(SoundSettings.getVolumePercentForType(type), 0, 0, 100) {
		private static final long serialVersionUID = 1L;
		
	};
	
	model.addChangeListener(new ChangeListener() {
		@Override public void stateChanged(ChangeEvent e) {
			type.adjustPercentage(model.getValue() );
			
			// Don't play demo sound unless slider has come to a rest, or that would get annoying real fast.
			if (!(model.getValueIsAdjusting() ) && model.getValue() != 0) {
				float gain = SoundUtils.resolveDecibelOffsetFromPercentage(model.getValue() );
				FloatControl gainControl = (FloatControl) demo.getControl(FloatControl.Type.MASTER_GAIN);
				gainControl.setValue(gain);
				demo.stop();
				demo.setFramePosition(0);
				demo.start();
			}
		}
	});
	
	setModel(model);
	
	setOpaque(false);
	setBorder(null);
	setUI(new MonkeyShinesSliderUI(this) );
	
}
 
開發者ID:ErikaRedmark,項目名稱:monkey-shines-java-port,代碼行數:44,代碼來源:VolumeSlider.java


注:本文中的javax.swing.BoundedRangeModel.addChangeListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。