public JPanel getInterfaceVisualizer() {
JPanel panel = new JPanel();
final JLabel ipLabel = new JLabel();
Observer observer;
this.addObserver(observer = new Observer() {
public void update(Observable obs, Object obj) {
if (isVersion4()) {
ipLabel.setText("IPv4 address: " + getIPString());
} else if (isVersion6()) {
ipLabel.setText((ipv6IsGlobal?"Global":"Local") +
" IPv6 address(#" + ipv6AddressIndex + "): " + getIPString());
} else {
ipLabel.setText("Unknown IP");
}
}
});
observer.update(null, null);
panel.add(ipLabel);
panel.putClientProperty("intf_obs", observer);
return panel;