当前位置: 首页>>代码示例>>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;未经允许,请勿转载。