2
* DemographicDialog.java
4
* (c) 2002-2005 BEAST Development Core Team
6
* This package may be distributed under the
7
* Lesser Gnu Public Licence (LGPL)
9
package figtree.treeviewer.annotations;
11
import jam.panels.OptionsPanel;
14
import javax.swing.border.EmptyBorder;
15
import java.util.List;
18
* DemographicDialog.java
21
* Description: An application for analysing MCMC trace files.
22
* @author Andrew Rambaut
23
* @author Alexei Drummond
24
* @version $Id: AnnotationDialog.java,v 1.5 2007/09/04 23:54:44 rambaut Exp $
26
public class SelectAnnotationDialog {
29
private OptionsPanel options;
30
private JComboBox annotationCombo;
32
public SelectAnnotationDialog(JFrame frame) {
36
public int showDialog(List<String> annotationNames) {
38
options = new OptionsPanel(6, 6);
40
annotationCombo = new JComboBox(annotationNames.toArray());
41
annotationCombo.setSelectedIndex(0);
44
JOptionPane optionPane = new JOptionPane(options,
45
JOptionPane.QUESTION_MESSAGE,
46
JOptionPane.OK_CANCEL_OPTION,
50
optionPane.setBorder(new EmptyBorder(12, 12, 12, 12));
52
final JDialog dialog = optionPane.createDialog(frame, "Select Annotation");
55
dialog.setVisible(true);
57
int result = JOptionPane.CANCEL_OPTION;
58
Integer value = (Integer)optionPane.getValue();
59
if (value != null && value.intValue() != -1) {
60
result = value.intValue();
66
private void setupOptionsPanel() {
69
options.addComponentWithLabel("Annotation:", annotationCombo);
73
public String getAnnotationName() {
74
return (String)annotationCombo.getSelectedItem();
b'\\ No newline at end of file'