import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
-import java.io.FileNotFoundException;
-import java.io.IOException;
import java.util.List;
import javax.swing.AbstractListModel;
import net.sf.openrocket.gui.util.GUIUtil;
import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.startup.Application;
-import net.sf.openrocket.util.BugException;
import net.sf.openrocket.util.Named;
public class GuidedTourSelectionDialog extends JDialog {
private static final Translator trans = Application.getTranslator();
- private static final String TOURS_BASE_DIR = "datafiles/tours";
-
+
private final SlideSetManager slideSetManager;
private final List<String> tourNames;
public GuidedTourSelectionDialog(Window parent) {
super(parent, trans.get("title"), ModalityType.MODELESS);
- try {
-
- slideSetManager = new SlideSetManager(TOURS_BASE_DIR);
- slideSetManager.load();
-
- tourNames = slideSetManager.getSlideSetNames();
- if (tourNames.isEmpty()) {
- throw new FileNotFoundException("No tours found.");
- }
-
- } catch (IOException e) {
- throw new BugException(e);
- }
+ slideSetManager = SlideSetManager.getSlideSetManager();
+ tourNames = slideSetManager.getSlideSetNames();
-
JPanel panel = new JPanel(new MigLayout("fill"));
panel.add(new StyledLabel(trans.get("lbl.selectTour"), Style.BOLD), "spanx, wrap rel");
}
}
});
- panel.add(new JScrollPane(tourList), "grow, gapright unrel, w 200lp, h 150lp");
+ panel.add(new JScrollPane(tourList), "grow, gapright unrel, w 200lp, h 250lp");
+
+
-
-
// Sub-panel containing description and start button
JPanel sub = new JPanel(new MigLayout("fill, ins 0"));
sub.add(new StyledLabel(trans.get("lbl.description"), -1), "wrap rel");
});
sub.add(start, "growx");
- panel.add(sub, "grow, wrap para, w 200lp, h 150lp");
+ panel.add(sub, "grow, wrap para, w 350lp, h 250lp");
+
+
-
-
JButton close = new JButton(trans.get("button.close"));
close.addActionListener(new ActionListener() {
@Override
this.add(panel);
GUIUtil.setDisposableDialogOptions(this, close);
+ GUIUtil.rememberWindowPosition(this);
tourList.setSelectedIndex(0);
}
}
-
-
+
+
}