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; } } } }
public static EventSounds getEventSounds( EventSounds initialValue, Options options, Component parent, MediaBagEditor mbe) { EventSounds result = null; Messages msg = options.getMessages(); EventSoundsEditorPanel evsed = dlgPanels.get(options); if (evsed == null) { // mbep=(MediaBagMultiEditorPanel)mbe.createEditorPanel(options); evsed = new EventSoundsEditorPanel(options, mbe); // evsed.setPreferredSize(new java.awt.Dimension(500, 500)); dlgPanels.put(options, evsed); } evsed.setEventSounds((EventSounds) initialValue.clone()); boolean b = msg.showInputDlg(parent, evsed, "edit_evsounds_dlg_title"); if (b) { result = evsed.getEventSounds(); } return result; }
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); }