// Update the number of peers and the peers window. void update(int peers) { if (window != null && this.peers != peers) { this.peers = peers; peersLabel.setText(String.valueOf(peers)); } peersWindow.update(); }
/** Handles buttons (Peers, Close). */ public void buttonEvent(ButtonEvent event) { if (event.isOfType(ButtonEvent.Type.CLICK)) { Object source = event.getSource(); if (source.equals(peersButton)) peersWindow.show(); else if (source.equals(closeButton)) { window.destroy(); window = null; } else System.err.println("Unknow event: " + event + " from source: " + source); } }