+ // Same for audio clips
+ if (_audioListModel.getSize() > 0)
+ {
+ int audioIndex = _trackInfo.getSelection().getCurrentAudioIndex();
+ int listSelection = _audioList.getSelectedIndex();
+ // Change listbox selection if indexes not equal
+ if (listSelection != audioIndex)
+ {
+ if (audioIndex < 0) {
+ _audioList.clearSelection();
+ }
+ else {
+ _audioList.setSelectedIndex(audioIndex);
+ }
+ }
+ }
+ }
+
+ /**
+ * Make one of the three list panels
+ * @param inNameKey key for heading text
+ * @param inList list object
+ * @return panel object
+ */
+ private static JPanel makeListPanel(String inNameKey, JList inList)
+ {
+ JPanel panel = new JPanel();
+ panel.setLayout(new BorderLayout());
+ panel.add(new JLabel(I18nManager.getText(inNameKey)), BorderLayout.NORTH);
+ inList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ panel.add(new JScrollPane(inList), BorderLayout.CENTER);
+ return panel;
+ }
+
+ /**
+ * Redraw the list panels in the display according to which ones should be shown
+ * @param inShowPhotos true to show photo list
+ * @param inShowAudio true to show audio list
+ */
+ private void redrawLists(boolean inShowPhotos, boolean inShowAudio)
+ {
+ // exit if same as last time
+ int panels = 1 + (inShowPhotos?2:0) + (inShowAudio?4:0);
+ if (panels == _visiblePanels) return;
+ _visiblePanels = panels;
+ // remove all panels and re-add them
+ _listsPanel.removeAll();
+ _listsPanel.setLayout(new GridLayout(0, 1));
+ _listsPanel.add(_waypointListPanel);
+ if (inShowPhotos) {
+ _listsPanel.add(_photoListPanel);
+ }
+ if (inShowAudio) {
+ _listsPanel.add(_audioListPanel);
+ }
+ _listsPanel.invalidate();
+ _listsPanel.getParent().validate();