本文整理了Java中java.util.Observable.notifyObservers()
方法的一些代码示例,展示了Observable.notifyObservers()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Observable.notifyObservers()
方法的具体详情如下:
包路径:java.util.Observable
类名称:Observable
方法名:notifyObservers
[英]If hasChanged() returns true, calls the update()method for every observer in the list of observers using null as the argument. Afterwards, calls clearChanged().
Equivalent to calling notifyObservers(null).
[中]如果hasChanged()返回true,则使用null作为参数为观察者列表中的每个观察者调用update()方法。之后,调用clearChanged()。
相当于调用NotifyObservators(null)。
代码示例来源:origin: robovm/robovm
/**
* If {@code hasChanged()} returns {@code true}, calls the {@code update()}
* method for every observer in the list of observers using null as the
* argument. Afterwards, calls {@code clearChanged()}.
* <p>
* Equivalent to calling {@code notifyObservers(null)}.
*/
public void notifyObservers() {
notifyObservers(null);
}
代码示例来源:origin: stackoverflow.com
import java.util.Observable;
public class Flux extends Observable {
private int someVariable = 0;
public void setSomeVariable(int someVariable) {
synchronized (this) {
this.someVariable = someVariable;
}
setChanged();
notifyObservers();
}
public synchronized int getSomeVariable() {
return someVariable;
}
}
代码示例来源:origin: stackoverflow.com
public class ObservableObject extends Observable {
private static ObservableObject instance = new ObservableObject();
public static ObservableObject getInstance() {
return instance;
}
private ObservableObject() {
}
public void updateValue(Object data) {
synchronized (this) {
setChanged();
notifyObservers(data);
}
}
}
代码示例来源:origin: stackoverflow.com
protected void onPostExecute(Boolean result) {
setChanged();
notifyObservers();
代码示例来源:origin: stackoverflow.com
this.notifyObservers(...);
代码示例来源:origin: stackoverflow.com
hidden = init();
setChanged();
notifyObservers();
notifyObservers(guess.equals(hidden));
代码示例来源:origin: stackoverflow.com
public class FilterManager extends Observable {
private String query;
public void setQuery(String query) {
this.query = query;
setChanged();
notifyObservers();
}
public String getQuery() {
return query;
}
}
代码示例来源:origin: Nilhcem/FakeSMTP
/**
* Notify the {@code LogsPane} object when a new log is received.
*
* @param arg a String representing the received log.
*/
@Override
public void notifyObservers(Object arg) {
setChanged();
super.notifyObservers(arg);
}
}
代码示例来源:origin: stackoverflow.com
if (observable!=null) {
observable.setChanged();
observable.notifyObservers(object);
代码示例来源:origin: stackoverflow.com
notifyObservers();
代码示例来源:origin: stackoverflow.com
notifyObservers();
代码示例来源:origin: stackoverflow.com
import java.util.Observable;
public class MyObservable extends Observable {
public void setText(String text){
notifyObservers(text);
}
}
代码示例来源:origin: com.gluonhq/robovm-rt
/**
* If {@code hasChanged()} returns {@code true}, calls the {@code update()}
* method for every observer in the list of observers using null as the
* argument. Afterwards, calls {@code clearChanged()}.
* <p>
* Equivalent to calling {@code notifyObservers(null)}.
*/
public void notifyObservers() {
notifyObservers(null);
}
代码示例来源:origin: ibinti/bugvm
/**
* If {@code hasChanged()} returns {@code true}, calls the {@code update()}
* method for every observer in the list of observers using null as the
* argument. Afterwards, calls {@code clearChanged()}.
* <p>
* Equivalent to calling {@code notifyObservers(null)}.
*/
public void notifyObservers() {
notifyObservers(null);
}
代码示例来源:origin: BruceEckel/OnJava8-Examples
@Override
public void notifyObservers() {
if(isOpen && !alreadyOpen) {
setChanged();
super.notifyObservers();
alreadyOpen = true;
}
}
}
代码示例来源:origin: BruceEckel/OnJava8-Examples
@Override
public void notifyObservers() {
if(!isOpen && !alreadyClosed) {
setChanged();
super.notifyObservers();
alreadyClosed = true;
}
}
}
代码示例来源:origin: BruceEckel/OnJava8-Examples
@Override
public void notifyObservers(Object b) {
// Otherwise it won't propagate changes:
setChanged();
super.notifyObservers(b);
}
}
代码示例来源:origin: stackoverflow.com
public static class YourObject extends Observable
{
public void setSomething(Object parameter)
{
// TODO some modification in YourObject
setChanged(); // From Observable : the object has changed
notifyObservers(parameter); // Notify the observer about the change
}
}
代码示例来源:origin: io.snappydata/snappydata-store-core
/**
Allow my users to notigy my observers.
*/
public void notifyObservers(Object arg) {
if (countObservers() != 0) {
setChanged();
super.notifyObservers(arg);
}
}
代码示例来源:origin: stackoverflow.com
private final Observable mObservable = new Observable();
private final static int TIME_STEP_MS = 5;
private final Handler mHandler = new Handler();
private final Runnable mTimeManager = new Runnable()
{
public void run()
{
mObservable.notifyObservers(TIME_STEP_MS);
mHandler.postDelayed(mTimeManager, TIME_STEP_MS);
}
};
内容来源于网络,如有侵权,请联系作者删除!