public void actionPerformed(java.awt.event.ActionEvent ev) { if (ev != null && ev.getSource() instanceof JCheckBox) { for (int i = 0; i < chkBoxes.length; i++) { if (chkBoxes[i] == ev.getSource()) { EventSoundsElement evse = evs.createElement(i); evse.setEnabled(chkBoxes[i].isSelected() ? JDomUtility.DEFAULT : JDomUtility.FALSE); updateDisplayFor(i); break; } } } }
public void propertyChange(PropertyChangeEvent ev) { if (ev != null && ev.getSource() instanceof SoundButton) { SoundButton src = (SoundButton) ev.getSource(); javax.swing.JLabel destLb = null; for (int i = 0; i < buttons.length; i++) { if (src == buttons[i]) { EventSoundsElement evse = evs.createElement(i); evse.setFileName(src.getSoundName()); updateDisplayFor(i); break; } } } }
protected void updateDisplayFor(int event) { EventSoundsElement evse = evs.getElement(event); boolean enabled = true; String msgKey = null; String msg = null; String fName = null; if (evse == null) { msgKey = "edit_evsounds_default"; } else { enabled = (evse.getEnabled() != JDomUtility.FALSE); if (!enabled) msgKey = "edit_evsounds_disabled"; else { fName = StrUtils.nullableString(evse.getFileName()); if (fName == null) msgKey = "edit_evsounds_default"; else msg = fName; } } if (msgKey != null) msg = options.getMsg(msgKey); txFields[event].setText(msg); buttons[event].setEnabled(enabled); buttons[event].setSoundName(fName); chkBoxes[event].setSelected(enabled); }