Skip to content

Commit

Permalink
NotesPanel: Beep when 'save' or 'revert' fails
Browse files Browse the repository at this point in the history
Due to there not being a current selection that can have notes.
  • Loading branch information
kingjon3377 committed Jun 4, 2020
1 parent 8d51fba commit d56d9f5
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ import lovelace.util.common {
as,
silentListener
}
import java.awt {
Toolkit
}

final class NotesPanel extends BorderedPanel satisfies UnitMemberListener&PlayerChangeListener {
JTextArea notesArea = JTextArea();
Expand All @@ -40,13 +43,17 @@ final class NotesPanel extends BorderedPanel satisfies UnitMemberListener&Player
void saveNotes() {
if (exists local = current) {
local.notes[player] = notesArea.text.trimmed;
} // FIXME: Else beep
} else {
Toolkit.defaultToolkit.beep();
}
}
notesApplyButton.addActionListener(silentListener(saveNotes));
void revertNotes() {
if (exists local = current) {
notesArea.text = local.notes.get(player) else "";
} // FIXME: Else beep
} else {
Toolkit.defaultToolkit.beep();
}
}
notesRevertButton.addActionListener(silentListener(revertNotes));
shared actual void memberSelected(UnitMember? previousSelection, UnitMember? selected) {
Expand Down

0 comments on commit d56d9f5

Please sign in to comment.