Example usage for javax.swing JComboBox isDisplayable

List of usage examples for javax.swing JComboBox isDisplayable

Introduction

In this page you can find the example usage for javax.swing JComboBox isDisplayable.

Prototype

public boolean isDisplayable() 

Source Link

Document

Determines whether this component is displayable.

Usage

From source file:eu.crisis_economics.abm.dashboard.Page_Parameters.java

void showHideSubparameters(final JComboBox combobox, final SubmodelInfo info) {
    if (!combobox.isDisplayable()) {
        return;/*from  w  w w.  ja  v  a2  s  .c  o  m*/
    }
    final ClassElement classElement = (ClassElement) combobox.getSelectedItem();

    info.setActualType(classElement.clazz, classElement.instance);
    final int level = calculateParameterLevel(info);
    for (int i = singleRunParametersPanel.getComponentCount() - 1; i >= level + 1; --i)
        singleRunParametersPanel.remove(i);

    if (classElement.clazz != null) {
        try {
            final List<ai.aitia.meme.paramsweep.batch.param.ParameterInfo<?>> subparameters = ParameterTreeUtils
                    .fetchSubparameters(currentModelHandler, info);
            String title = "Configure " + info.getName().replaceAll("([A-Z])", " $1").trim();
            createAndDisplayAParameterPanel(subparameters, title, info, true, currentModelHandler);
        } catch (final ModelInformationException e) {
            info.setActualType(null, null);
            JOptionPane.showMessageDialog(wizard, new JLabel(e.getMessage()), "Error while analyizing model",
                    JOptionPane.ERROR_MESSAGE);
            e.printStackTrace();
            combobox.setSelectedIndex(0);
        }
    }

    parametersScrollPane.invalidate();
    parametersScrollPane.validate();
    final JScrollBar horizontalScrollBar = parametersScrollPane.getHorizontalScrollBar();
    horizontalScrollBar.setValue(horizontalScrollBar.getMaximum());
}