ssLabel.setText("Signal strength (not auto-updated): "
+ String.format("%1.1f", getCurrentSignalStrength()) + " dBm");
}
});
final Observer observer = new Observer() {
public void update(Observable obs, Object obj) {
if (isTransmitting()) {
statusLabel.setText("Transmitting");
} else if (isReceiving()) {
statusLabel.setText("Receiving");
} else {
statusLabel.setText("Listening");
}
lastEventLabel.setText("Last event (time=" + lastEventTime + "): " + lastEvent);
ssLabel.setText("Signal strength (not auto-updated): "
+ String.format("%1.1f", getCurrentSignalStrength()) + " dBm");
if (getChannel() == -1) {
channelLabel.setText("Current channel: ALL");
} else {
channelLabel.setText("Current channel: " + getChannel());
}
}
};
this.addObserver(observer);
observer.update(null, null);
panel.add(BorderLayout.NORTH, box);
panel.putClientProperty("intf_obs", observer);
return panel;
}