package versusSNP.gui.dialogs;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import versusSNP.Size;
import versusSNP.gui.UICaption;
import versusSNP.util.action.SelectAction;
import versusSNP.util.struct.MyInteger;
public class QuerySubjectSelectDialog extends JOptionPane implements GenericDialog {
private static final long serialVersionUID = -823500601718058448L;
private JComboBox selector1;
private JComboBox selector2;
private MyInteger id1, id2;
public QuerySubjectSelectDialog(String[] genomeNames) {
id1 = new MyInteger(0);
id2 = new MyInteger(1);
selector1 = new JComboBox(genomeNames);
selector2 = new JComboBox(genomeNames);
selector1.setSelectedIndex(id1.intValue());
selector2.setSelectedIndex(id2.intValue());
selector1.setPreferredSize(Size.dialog_combobox_selector);
selector2.setPreferredSize(Size.dialog_combobox_selector);
selector1.addActionListener(new SelectAction(id1));
selector2.addActionListener(new SelectAction(id2));
}
public int showDialog() {
Object[] options = {UICaption.dialog_option_ok, UICaption.dialog_option_cancel};
return showOptionDialog(null, new Object[] {
new JLabel(UICaption.dialog_label_querysubjectselect_query),
selector1,
new JLabel(UICaption.dialog_label_querysubjectselect_subject),
selector2 },
UICaption.dialog_caption_querysubjectselect,
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.PLAIN_MESSAGE,
null, options, options[0]);
}
public int getId1() {
return id1.intValue();
}
public int getId2() {
return id2.intValue();
}
public int[] getIds() {
return new int[]{id1.intValue(), id2.intValue()};
}
}