@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == showBut) { parentFrame.tellServer("showbutton"); } else if (e.getSource() == hideBut) { parentFrame.tellServer("hidebutton"); } else if (e.getSource() == killBut) { if (checkKillButton() == JOptionPane.OK_OPTION) { parentFrame.tellServer("killserver"); } } }
/** * Changes the current displayed status of the button. * * @param status the status of the button. */ public void updateStatusLabel(String status) { switch (status) { case "visible": statusLab.setText("Button is currently VISIBLE"); break; case "hidden": statusLab.setText("Button is currently NOT VISIBLE"); break; case "kill": statusLab.setText("Button has been shutdown"); parentFrame.closeAll(); setServerDeadState(); break; case "ringbell": playBell(); break; default: statusLab.setText("Anomalous state: " + status + ". This should not happen"); break; } }
public AdminPane(MainClientHub mainClientFrame) { super(); parentFrame = mainClientFrame; setLayout(new BorderLayout()); initComponents(); addHandlers(); addComponents(); // Asks for the current state of the button so that the status label is // updated correctly. parentFrame.tellServer("requestcurrentstate"); }