Search in sources :

Example 6 with OptionsPanel

use of jam.panels.OptionsPanel in project beast-mcmc by beast-dev.

the class HierarchicalPriorDialog method setupComponents.

private void setupComponents() {
    panel.removeAll();
    JPanel mainPanel = new JPanel(new GridBagLayout());
    panel.add(mainPanel);
    OptionsPanel[] optionsPanel = new OptionsPanel[4];
    JPanel[] panel = new JPanel[4];
    for (int i = 0; i < 4; ++i) {
        optionsPanel[i] = new OptionsPanel(12, (OSType.isMac() ? 6 : 24));
        panel[i] = new JPanel(new FlowLayout(FlowLayout.CENTER));
        if (i > 1) {
            panel[i].setLayout(new BoxLayout(panel[i], BoxLayout.PAGE_AXIS));
        }
        panel[i].add(optionsPanel[i]);
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.gridx = i % 2;
        gbc.gridy = i / 2;
        mainPanel.add(panel[i], gbc);
    }
    optionsPanel[0].addComponent(new JLabel("Select HPM for parameters: "));
    OptionsPanel list = new OptionsPanel();
    list.setBackground(Color.WHITE);
    list.setOpaque(true);
    for (Parameter p : parameterList) {
        JLabel label = new JLabel("\t" + p.getName());
        label.setForeground(Color.DARK_GRAY);
        list.addSpanningComponent(label);
    }
    optionsPanel[0].addSpanningComponent(list);
    PriorType modelType;
    optionsPanel[1].addComponentWithLabel("Hierarchical Distribution: ", priorCombo);
    modelType = (PriorType) priorCombo.getSelectedItem();
    optionsPanel[1].addSeparator();
    String modelName = "untitled";
    nameField = new JTextField(modelName);
    nameField.setColumns(10);
    optionsPanel[1].addComponentWithLabel("Unique Name: ", nameField);
    optionsPanel[2].addSeparator();
    optionsPanel[3].addSeparator();
    optionsPanel[2].addSpanningComponent(new JLabel("Population Mean Hyperprior: Normal"));
    optionsPanel[3].addSpanningComponent(new JLabel("Population Precision Hyperprior: Gamma"));
    optionsPanel[2].addSpanningComponent(optionsPanels.get(PriorType.NORMAL_PRIOR));
    optionsPanel[3].addSpanningComponent(optionsPanels.get(PriorType.GAMMA_PRIOR));
    optionsPanel[2].addSeparator();
    optionsPanel[3].addSeparator();
    setupChart();
    for (int i = 0; i < 2; ++i) {
        chart[i].setPreferredSize(new Dimension(300, 200));
        chart[i].setFontSize(8);
        panel[2 + i].add(chart[i]);
        panel[2 + i].add(quantilePanel[i]);
    }
    setArguments(modelType);
    mainPanel.repaint();
}
Also used : PriorType(dr.app.beauti.types.PriorType) Parameter(dr.app.beauti.options.Parameter) OptionsPanel(jam.panels.OptionsPanel)

Aggregations

OptionsPanel (jam.panels.OptionsPanel)6 PriorType (dr.app.beauti.types.PriorType)2 Parameter (dr.app.beauti.options.Parameter)1 RealNumberField (dr.app.gui.components.RealNumberField)1 WholeNumberField (dr.app.gui.components.WholeNumberField)1 Taxa (dr.evolution.util.Taxa)1 Taxon (dr.evolution.util.Taxon)1 ActionPanel (jam.panels.ActionPanel)1 ItemEvent (java.awt.event.ItemEvent)1 ItemListener (java.awt.event.ItemListener)1 EmptyBorder (javax.swing.border.EmptyBorder)1 BorderUIResource (javax.swing.plaf.BorderUIResource)1