Example usage for javax.swing JComboBox setSelectedItem

List of usage examples for javax.swing JComboBox setSelectedItem

Introduction

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

Prototype

@BeanProperty(bound = false, preferred = true, description = "Sets the selected item in the JComboBox.")
public void setSelectedItem(Object anObject) 

Source Link

Document

Sets the selected item in the combo box display area to the object in the argument.

Usage

From source file:com.intuit.tank.tools.debugger.ActionProducer.java

public void setChoiceComboBoxOptions(JComboBox<TankClientChoice> cb) {
    cb.removeAllItems();//from w w  w .  ja  v a2 s.  c om
    try {
        TankHttpClientDefinitionContainer clientDefinitions = agentServiceClient.getClientDefinitions();
        for (TankHttpClientDefinition def : clientDefinitions.getDefinitions()) {
            TankClientChoice c = new TankClientChoice(def.getName(), def.getClassName());
            cb.addItem(c);
            if (def.getClassName().equals(clientDefinitions.getDefaultDefinition())) {
                cb.setSelectedItem(c);
            }
        }
    } catch (Exception e) {
        //            set to default
        cb.addItem(
                new TankClientChoice("Apache HttpClient 3.1", "com.intuit.tank.httpclient3.TankHttpClient3"));
        cb.addItem(
                new TankClientChoice("Apache HttpClient 4.5", "com.intuit.tank.httpclient4.TankHttpClient4"));
        cb.setSelectedIndex(1);
    }
}

From source file:brainflow.app.toplevel.BrainFlow.java

private IImageSource specialHandling(IImageSource dataSource) {

    if (dataSource.getFileFormat().equals("Analyze7.5")) {
        JPanel panel = new JPanel();
        JLabel messageLabel = new JLabel("Please select correct image orientation from menu: ");
        java.util.List<Anatomy3D> choices = Anatomy3D.getInstanceList();
        JComboBox choiceBox = new JComboBox(choices.toArray());

        //todo hackery alert
        Anatomy anatomy = dataSource.getImageInfo().getAnatomy();
        choiceBox.setSelectedItem(anatomy);

        FormLayout layout = new FormLayout("4dlu, l:p, p:g, 4dlu", "6dlu, p, 10dlu, p, 6dlu");
        CellConstraints cc = new CellConstraints();
        panel.setLayout(layout);/*www .  j a  va2s . c o m*/
        panel.add(messageLabel, cc.xyw(2, 2, 2));
        panel.add(choiceBox, cc.xyw(2, 4, 2));

        JOptionPane.showMessageDialog(brainFrame, panel, "Analyze 7.5 image format ...",
                JOptionPane.WARNING_MESSAGE);
        Anatomy selectedAnatomy = (Anatomy) choiceBox.getSelectedItem();
        if (selectedAnatomy != anatomy) {
            //todo hackery alert
            dataSource.getImageInfo().setAnatomy((Anatomy3D) selectedAnatomy);
            dataSource.releaseData();
        }
    }

    return dataSource;

}

From source file:io.github.jeddict.jpa.modeler.source.generator.ui.GenerateCodeDialog.java

private void selectProject(JComboBox projectCombo, ProjectInfo projectInfo) {
    if (projectInfo.getProject() == null) {
        if (projectCombo.getSelectedItem() != null) {
            projectInfo.setProject((Project) projectCombo.getSelectedItem());
        }//www  . jav a2s  . co m
    } else {
        projectCombo.setSelectedItem(projectInfo.getProject());
    }
    if (projectCombo.getSelectedItem() != null) {
        populateSourceFolderCombo(projectInfo);
    }
}

From source file:net.itransformers.topologyviewer.gui.GraphViewerPanel.java

private JComboBox createHopsCombo() {
    HopsType hopsType = viewerConfig.getHops();
    JComboBox hopsCombo = new JComboBox();
    if (hopsType == null)
        return hopsCombo;
    String[] hopsArr = hopsType.getValue().split(",");
    for (String hops : hopsArr) {
        final int hopsInt = Integer.parseInt(hops);
        hopsCombo.addItem(hopsInt);//from  w ww.ja v  a 2  s. c om
    }
    hopsCombo.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Integer hops = (Integer) ((JComboBox) e.getSource()).getSelectedItem();
            currentHops = hops;
        }
    });
    currentHops = Integer.valueOf(hopsType.getSelected());
    hopsCombo.setSelectedItem(currentHops);
    return hopsCombo;
}

From source file:com.freedomotic.jfrontend.MainWindow.java

/**
 * //from w  w w. j a  v a  2 s . c om
 * @param evt 
 */
private void mnuLanguageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuLanguageActionPerformed
    //JDK 1,7 version: JComboBox<i18n.ComboLanguage> combo = new JComboBox<i18n.ComboLanguage>(I18n.getAvailableLocales());
    //JDK 1.6 version: next line
    Vector<ComboLanguage> languages = new Vector<ComboLanguage>();
    for (Locale loc : i18n.getAvailableLocales()) {
        languages.add(new ComboLanguage(
                loc.getDisplayCountry(i18n.getDefaultLocale()) + " - " + loc.getDisplayLanguage(loc),
                loc.toString(), loc));
    }
    Collections.sort(languages);
    languages.add(new ComboLanguage("Automatic", "auto", Locale.ENGLISH));

    JComboBox combo = new JComboBox(languages);

    for (ComboLanguage cmb : languages) {
        if (cmb.getValue().equals(i18n.getDefaultLocale())) {
            combo.setSelectedItem(cmb);
            break;
        }
    }
    JLabel lbl = new JLabel(i18n.msg("language"));
    int result = JOptionPane.showConfirmDialog(this, new Object[] { lbl, combo }, i18n.msg("language"),
            JOptionPane.OK_CANCEL_OPTION);
    if (result == JOptionPane.OK_OPTION) {
        ComboLanguage selected = (ComboLanguage) combo.getSelectedItem();
        i18n.setDefaultLocale(selected.getValue());
        updateStrings();
    }
}

From source file:ucar.unidata.idv.control.JythonControl.java

/**
 * Make the developer UI contents/*from   w  ww.j  a  va2 s. c om*/
 * @return  UI for developer code
 */
private JComponent doMakeDeveloperContents() {

    labelFld = new JTextField((myName != null) ? myName : "", 15);
    labelFld.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            setMyName(labelFld.getText().trim());
        }
    });

    Vector probeItems = new Vector();
    for (int i = 0; i < PROBES.length; i++) {
        probeItems.add(new TwoFacedObject(PROBE_NAMES[i], PROBES[i]));
    }
    final JComboBox probeCbx = new JComboBox(probeItems);
    probeCbx.setSelectedItem(new TwoFacedObject(getProbeName(probeType), probeType));
    probeCbx.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            try {
                probeType = ((TwoFacedObject) probeCbx.getSelectedItem()).getId().toString();
                doMakeProbe();
            } catch (Exception exc) {
                logException("Changing probe type", exc);
            }
        }
    });

    displayCategoryFld = new JTextField(jythonDisplayCategory, 15);

    categoriesFld = new JTextArea("", 4, 20);
    if (dataCategories != null) {
        categoriesFld.setText(dataCategories);
    }

    Component[] comps = { GuiUtils.rLabel("Display name: "), GuiUtils.left(labelFld),
            GuiUtils.rLabel("Display Category:"), GuiUtils.left(displayCategoryFld),
            GuiUtils.top(GuiUtils.rLabel("Data Categories:")), GuiUtils.left(new JScrollPane(categoriesFld)),
            GuiUtils.rLabel("Probe Type:"), GuiUtils.left(GuiUtils.hflow(Misc.newList(probeCbx,
                    GuiUtils.rLabel("  Probe Color: "), doMakeColorControl(getColor())))) };

    GuiUtils.tmpInsets = GuiUtils.INSETS_5;
    JPanel fldPanel = GuiUtils.doLayout(comps, 2, GuiUtils.WT_NYN, GuiUtils.WT_N);

    try {
        if (jythonCode == null) {
            jythonCode = IOUtil.readContents("/ucar/unidata/idv/control/jythoncontrol.py", "");
        }

        jythonEditor = new JPythonEditor();
        jythonEditor.setText(jythonCode);
        jythonEditor.setPreferredSize(new Dimension(400, 300));
    } catch (VisADException exc) {
        logException("Creating Jython editor", exc);
    }
    JComponent jythonPanel = new JScrollPane(jythonEditor);
    JTabbedPane tab = GuiUtils.getNestedTabbedPane();
    tab.add("Settings", GuiUtils.top(fldPanel));
    List buttons = Misc.newList(GuiUtils.makeButton("Evaluate Init", this, "execJython", "handleInit"),
            GuiUtils.makeButton("Evaluate Data", this, "execJython", "handleData"));

    JPanel buttonPanel = GuiUtils.left(GuiUtils.hbox(buttons));
    tab.add("Jython", GuiUtils.topCenter(buttonPanel, jythonPanel));
    tab.add("Result GUI", jythonContainer);
    return tab;
}

From source file:io.github.jeddict.jpa.modeler.source.generator.ui.GenerateCodeDialog.java

private void populateProjectCombo(JComboBox projectCombo, ProjectInfo projectInfo) {
    ProjectCellRenderer projectCellRenderer = new ProjectCellRenderer(projectCombo.getRenderer());
    projectCombo.setRenderer(projectCellRenderer);
    List<Project> list = getJavaProjects();

    if (list == null || list.isEmpty()) {
        enableExistingProjectElementGroup(false);
    } else {//from  w  w  w. ja v  a2s .  c o  m
        DefaultComboBoxModel projectsModel = new DefaultComboBoxModel(list.toArray());
        projectCombo.setModel(projectsModel);

        // Issue Fix #5850 
        Project modelerProject = FileOwnerQuery.getOwner(modelerFileObject);
        if (modelerProject != null) {
            projectCombo.setSelectedItem(modelerProject);
        } else {
            projectCombo.setSelectedIndex(-1);
        }
        selectProject(projectCombo, projectInfo);
    }
}

From source file:eu.apenet.dpt.standalone.gui.eag2012.EagInstitutionPanel.java

/**
 * Builds and answer the editor's general tab for the given layout.
 *
 * @return the editor's general panel/* ww  w  .  j a  v  a2 s.  c  om*/
 */
protected JComponent buildEditorPanel(List<String> errors) {

    if (errors == null) {
        errors = new ArrayList<String>(0);
    } else if (Utilities.isDev && errors.size() > 0) {
        LOG.info("Errors in form:");
        for (String error : errors) {
            LOG.info(error);
        }
    }

    FormLayout layout = new FormLayout("right:max(50dlu;p), 4dlu, 100dlu, 7dlu, right:p, 4dlu, 100dlu",
            EDITOR_ROW_SPEC);

    layout.setColumnGroups(new int[][] { { 1, 3, 5, 7 } });
    PanelBuilder builder = new PanelBuilder(layout);

    builder.setDefaultDialogBorder();
    CellConstraints cc = new CellConstraints();

    rowNb = 1;
    builder.addSeparator(labels.getString("eag2012.tab.yourInstitution"), cc.xyw(1, rowNb, 7));
    setNextRow();
    builder.addLabel(labels.getString("eag2012.commons.personResponsible"), cc.xy(1, rowNb));

    int sizeEvents = eag.getControl().getMaintenanceHistory().getMaintenanceEvent().size();
    if (sizeEvents == 0) {
        if (StringUtils.isNotEmpty(Eag2012Frame.getPersonResponsible())) {
            personTf = new JTextField(Eag2012Frame.getPersonResponsible());
        } else {
            personTf = new JTextField("");
        }
    } else {
        MaintenanceEvent event = eag.getControl().getMaintenanceHistory().getMaintenanceEvent()
                .get(sizeEvents - 1);
        personTf = new JTextField(event.getAgent().getContent());
    }

    builder.add(personTf, cc.xy(3, rowNb));
    setNextRow();
    builder.addLabel(labels.getString("eag2012.commons.countryCode") + "*", cc.xy(1, rowNb));
    if (isNew && StringUtils.isEmpty(eag.getArchguide().getIdentity().getRepositorid().getCountrycode())) {
        countryCodeTf = new JTextField(countrycode);
    } else {
        countryCodeTf = new JTextField(eag.getArchguide().getIdentity().getRepositorid().getCountrycode());
    }
    countryCodeTf.addKeyListener(new CheckKeyListener());
    builder.add(countryCodeTf, cc.xy(3, rowNb));
    setNextRow();
    if (errors.contains("countryCodeTf")) {
        builder.add(createErrorLabel(labels.getString("eag2012.errors.countryCode")), cc.xy(1, rowNb));
        setNextRow();
    }

    if (eag.getControl().getOtherRecordId().size() == 0) {
        eag.getControl().getOtherRecordId().add(new OtherRecordId());
        if (isNew && StringUtils.isNotEmpty(mainagencycode)) {
            eag.getControl().getOtherRecordId().get(0).setLocalType("yes");
            eag.getControl().getOtherRecordId().get(0).setValue(mainagencycode);
        }
    }

    otherRecordIdTfs = new ArrayList<TextFieldWithCheckbox>(eag.getControl().getOtherRecordId().size());
    for (OtherRecordId otherRecordId : eag.getControl().getOtherRecordId()) {

        String mandatoryStar = "*";
        if (otherRecordId != eag.getControl().getOtherRecordId().get(0))
            mandatoryStar = "";

        TextFieldWithCheckbox textFieldWithCheckbox = new TextFieldWithCheckbox(otherRecordId.getValue(),
                otherRecordId.getLocalType());
        otherRecordIdTfs.add(textFieldWithCheckbox);
        builder.addLabel(labels.getString("eag2012.control.identifierInstitution") + mandatoryStar,
                cc.xy(1, rowNb));
        builder.add(textFieldWithCheckbox.getTextField(), cc.xy(3, rowNb));
        builder.addLabel(labels.getString("eag2012.isil.isThisISIL"), cc.xy(5, rowNb));
        textFieldWithCheckbox.getTextField().addKeyListener(new CheckKeyListener());
        builder.add(textFieldWithCheckbox.getIsilOrNotCombo(), cc.xy(7, rowNb));
        textFieldWithCheckbox.getIsilOrNotCombo()
                .addActionListener(new ComboboxActionListener(textFieldWithCheckbox));
        setNextRow();
    }
    if (errors.contains("otherRecordIdTfs")) {
        builder.add(createErrorLabel(labels.getString("eag2012.errors.notIdentifierInstitution")),
                cc.xy(1, rowNb));
        setNextRow();
    }

    JButton addNewOtherIdentifierBtn = new ButtonTab(
            labels.getString("eag2012.yourinstitution.addOtherIdentifier"));
    addNewOtherIdentifierBtn.addActionListener(new AddOtherIdentifierAction(eag, tabbedPane, model));
    builder.add(addNewOtherIdentifierBtn, cc.xy(3, rowNb));

    builder.addLabel(labels.getString("eag2012.commons.idUsedInApe"), cc.xy(5, rowNb));
    if (Eag2012ValidFields.isRepositoryCodeCorrect(eag.getControl().getRecordId().getValue())) {
        idUsedInApeTf = new JTextField(eag.getControl().getRecordId().getValue());
    } else {
        idUsedInApeTf = new JTextField(TextChanger.getNewText(otherRecordIdTfs, countryCodeTf.getText()));
    }
    idUsedInApeTf.setEnabled(false);
    idUsedInApeTf.setEditable(false);
    builder.add(idUsedInApeTf, cc.xy(7, rowNb));
    setNextRow();

    if (eag.getArchguide().getIdentity().getAutform().size() == 0) {
        eag.getArchguide().getIdentity().getAutform().add(new Autform());
    }
    nameInstitutionTfs = new ArrayList<TextFieldWithLanguage>(
            eag.getArchguide().getIdentity().getAutform().size());
    for (Autform autform : eag.getArchguide().getIdentity().getAutform()) {
        TextFieldWithLanguage textFieldWithLanguage = new TextFieldWithLanguage(autform.getContent(),
                autform.getLang());
        nameInstitutionTfs.add(textFieldWithLanguage);
        builder.addLabel(labels.getString("eag2012.commons.nameOfInstitution") + "*", cc.xy(1, rowNb));
        builder.add(textFieldWithLanguage.getTextField(), cc.xy(3, rowNb));
        builder.addLabel(labels.getString("eag2012.commons.language"), cc.xy(5, rowNb));
        builder.add(textFieldWithLanguage.getLanguageBox(), cc.xy(7, rowNb));
        setNextRow();
    }
    if (errors.contains("nameInstitutionTfs")) {
        builder.add(createErrorLabel(labels.getString("eag2012.errors.nameInstitutionEmpty")), cc.xy(1, rowNb));
        setNextRow();
    }

    if (eag.getArchguide().getIdentity().getParform().size() == 0) {
        eag.getArchguide().getIdentity().getParform().add(new Parform());
    }
    parallelNameTfs = new ArrayList<TextFieldWithLanguage>(
            eag.getArchguide().getIdentity().getParform().size());
    for (Parform parform : eag.getArchguide().getIdentity().getParform()) {
        TextFieldWithLanguage textFieldWithLanguage = new TextFieldWithLanguage(parform.getContent(),
                parform.getLang());
        parallelNameTfs.add(textFieldWithLanguage);
        builder.addLabel(labels.getString("eag2012.commons.parallelNameOfInstitution"), cc.xy(1, rowNb));
        builder.add(textFieldWithLanguage.getTextField(), cc.xy(3, rowNb));
        builder.addLabel(labels.getString("eag2012.commons.language"), cc.xy(5, rowNb));
        builder.add(textFieldWithLanguage.getLanguageBox(), cc.xy(7, rowNb));
        setNextRow();
    }

    //print repositoryType combo
    if (eag.getArchguide().getIdentity().getRepositoryType() != null
            && !eag.getArchguide().getIdentity().getRepositoryType().isEmpty()) {
        for (RepositoryType repoType : eag.getArchguide().getIdentity().getRepositoryType()) {
            builder.addLabel(labels.getString("eag2012.identity.selectType"), cc.xy(1, rowNb));
            JComboBox comboBox = new JComboBox(typeInstitution);
            if (repoType.getValue() != null && !repoType.getValue().isEmpty()) {
                comboBox.setSelectedItem(repoType.getValue());
            } else {
                comboBox.setSelectedItem("---");
            }
            typeInstitutionComboList.add(comboBox);
            builder.add(comboBox, cc.xy(3, rowNb));
            setNextRow();
        }
    } else {
        builder.addLabel(labels.getString("eag2012.identity.selectType"), cc.xy(1, rowNb));
        JComboBox comboBox = new JComboBox(typeInstitution);
        comboBox.setSelectedItem("---");
        typeInstitutionComboList.add(comboBox);
        builder.add(comboBox, cc.xy(3, rowNb));
        setNextRow();
    }

    //add another repositoryType button
    JButton addNewTypeOfTheInstitution = new ButtonTab(
            labels.getString("eag2012.yourinstitution.addAnotherRepositoryType"));
    addNewTypeOfTheInstitution.addActionListener(new AddRepositoryTypeAction(eag, tabbedPane, model));
    builder.add(addNewTypeOfTheInstitution, cc.xy(1, rowNb));
    setNextRow();

    builder.addSeparator("", cc.xyw(1, this.rowNb, 7));
    setNextRow();

    //        if(eag.getArchguide().getDesc().getRepositories().getRepository().size() == 1) { //todo: BECAUSE FOR NOW ONLY ONE REPOSITORY!!!!
    Repository repository = eag.getArchguide().getDesc().getRepositories().getRepository().get(repositoryNb);

    boolean hasMinimumOnePostalAddress = false;
    boolean hasMinimumOneVisitorAddress = false;
    locationFields = new ArrayList<LocationType>(repository.getLocation().size());
    //        int locationNb = 0;
    for (Location location : repository.getLocation()) {
        //            locationNb++;
        boolean isPostal = false;
        LocationType locationType = new LocationType(location);
        if (StringUtils.isEmpty(location.getLocalType())
                || location.getLocalType().equals("visitors address")) {
            locationType.setLocalType("visitors address");
            if (hasMinimumOneVisitorAddress) {
                locationType.getLatitudeTf().setEnabled(false);
                locationType.getLongitudeTf().setEnabled(false);
            }
            builder.addSeparator(labels.getString("eag2012.commons.visitorsAddress"), cc.xyw(1, rowNb, 7));
            isPostal = false;
            hasMinimumOneVisitorAddress = true;
        } else if (location.getLocalType().equals("postal address")) {
            //                builder.addSeparator(labels.getString("eag2012.commons.postalAddress"), cc.xyw(1, rowNb, 7));
            isPostal = true;
            //                hasMinimumOnePostalAddress = true;
        }
        if (!isPostal) {
            locationFields.add(locationType);
            setNextRow();

            String mandatoryStar = "*";
            if (isPostal || location != repository.getLocation().get(0)) {
                mandatoryStar = "";
            }

            builder.addLabel(labels.getString("eag2012.commons.street") + mandatoryStar, cc.xy(1, rowNb));
            builder.add(locationType.getStreetTf().getTextField(), cc.xy(3, rowNb));
            builder.addLabel(labels.getString("eag2012.commons.language"), cc.xy(5, rowNb));
            builder.add(locationType.getStreetTf().getLanguageBox(), cc.xy(7, rowNb));
            if (errors.contains("streetTf") && StringUtils.isEmpty(locationType.getStreetTfValue())) {
                setNextRow();
                builder.add(createErrorLabel(labels.getString("eag2012.errors.street")), cc.xy(1, rowNb));
            }
            setNextRow();

            builder.addLabel(labels.getString("eag2012.commons.cityTownWithPostalcode") + mandatoryStar,
                    cc.xy(1, rowNb));
            builder.add(locationType.getCityTf().getTextField(), cc.xy(3, rowNb));
            builder.addLabel(labels.getString("eag2012.commons.language"), cc.xy(5, rowNb));
            builder.add(locationType.getCityTf().getLanguageBox(), cc.xy(7, rowNb));
            if (errors.contains("cityTf") && StringUtils.isEmpty(locationType.getCityTfValue())) {
                setNextRow();
                builder.add(createErrorLabel(labels.getString("eag2012.errors.city")), cc.xy(1, rowNb));
            }
            setNextRow();

            builder.addLabel(labels.getString("eag2012.commons.country") + mandatoryStar, cc.xy(1, rowNb));
            builder.add(locationType.getCountryTf().getTextField(), cc.xy(3, rowNb));
            builder.addLabel(labels.getString("eag2012.commons.language"), cc.xy(5, rowNb));
            builder.add(locationType.getCountryTf().getLanguageBox(), cc.xy(7, rowNb));
            if (errors.contains("countryTf") && StringUtils.isEmpty(locationType.getCountryTfValue())) {
                setNextRow();
                builder.add(createErrorLabel(labels.getString("eag2012.errors.country")), cc.xy(1, rowNb));
            }
            setNextRow();

            builder.addLabel(labels.getString("eag2012.commons.latitude"), cc.xy(1, rowNb));
            locationType.getLatitudeTf()
                    .addFocusListener(new UpdateCoordsText(locationType, EagContactPanel.LATITUDE));
            builder.add(locationType.getLatitudeTf(), cc.xy(3, rowNb));
            builder.addLabel(labels.getString("eag2012.commons.longitude"), cc.xy(5, rowNb));
            locationType.getLongitudeTf()
                    .addFocusListener(new UpdateCoordsText(locationType, EagContactPanel.LONGITUDE));
            builder.add(locationType.getLongitudeTf(), cc.xy(7, rowNb));
            setNextRow();
        }
    }

    if (hasMinimumOneVisitorAddress) {
        JButton addNewVisitorTranslationAddressBtn = new ButtonTab(
                labels.getString("eag2012.commons.addVisitorTranslationAddress"), true);
        addNewVisitorTranslationAddressBtn
                .addActionListener(new AddAddressAction(eag, tabbedPane, model, false));
        builder.add(addNewVisitorTranslationAddressBtn, cc.xy(3, rowNb));
        setNextRow();
    } else {
        JButton addNewVisitorAddressBtn = new ButtonTab(labels.getString("eag2012.commons.addVisitorAddress"));
        addNewVisitorAddressBtn.addActionListener(new AddAddressAction(eag, tabbedPane, model, false));
        builder.add(addNewVisitorAddressBtn, cc.xy(3, rowNb));
        setNextRow();
    }

    builder.addLabel(labels.getString("eag2012.commons.continent") + "*", cc.xy(1, rowNb));
    if (Arrays.asList(continents).contains(repository.getGeogarea().getValue())) {
        continentCombo.setSelectedItem(repository.getGeogarea().getValue());
    } else {
        continentCombo.setSelectedItem("Europe");
    }
    builder.add(continentCombo, cc.xy(3, rowNb));
    setNextRow();
    builder.addLabel(labels.getString("eag2012.commons.telephone"), cc.xy(1, rowNb));
    if (repository.getTelephone().size() > 0) {
        telephoneTf = new JTextField(repository.getTelephone().get(0).getContent());
    } else {
        telephoneTf = new JTextField();
    }
    builder.add(telephoneTf, cc.xy(3, rowNb));
    setNextRow();

    builder.addLabel(labels.getString("eag2012.commons.email"), cc.xy(1, rowNb));
    if (repository.getEmail().size() > 0) {
        emailTf = new JTextField(repository.getEmail().get(0).getHref());
        emailTitleTf = new JTextField(repository.getEmail().get(0).getContent());
    } else {
        emailTf = new JTextField();
        emailTitleTf = new JTextField();
    }
    builder.add(emailTf, cc.xy(3, rowNb));
    builder.addLabel(labels.getString("eag2012.commons.linkTitle"), cc.xy(5, rowNb));
    builder.add(emailTitleTf, cc.xy(7, rowNb));
    setNextRow();

    builder.addLabel(labels.getString("eag2012.commons.webpage"), cc.xy(1, rowNb));
    if (repository.getWebpage().size() > 0) {
        webpageTf = new JTextField(repository.getWebpage().get(0).getHref());
        if (!StringUtils.isBlank(repository.getWebpage().get(0).getContent())) {
            webpageTitleTf = new JTextField(repository.getWebpage().get(0).getContent());
        } else {
            webpageTitleTf = new JTextField();
        }
    } else {
        webpageTf = new JTextField();
        webpageTitleTf = new JTextField();
    }
    builder.add(webpageTf, cc.xy(3, rowNb));
    builder.addLabel(labels.getString("eag2012.commons.linkTitle"), cc.xy(5, rowNb));
    builder.add(webpageTitleTf, cc.xy(7, rowNb));
    setNextRow();
    if ((StringUtils.isNotBlank(webpageTf.getText())
            && !StringUtils.startsWithAny(webpageTf.getText(), webPrefixes)) || errors.contains("webpageTf")) {
        builder.add(createErrorLabel(labels.getString("eag2012.errors.webpageProtocol")), cc.xy(1, rowNb));
        setNextRow();
    }

    if (repository.getTimetable().getOpening().size() == 0) {
        repository.getTimetable().getOpening().add(new Opening());
    }
    openingHoursTfs = new ArrayList<TextFieldWithLanguage>(repository.getTimetable().getOpening().size());
    for (Opening opening : repository.getTimetable().getOpening()) {
        builder.addLabel(labels.getString("eag2012.commons.openingHours") + "*", cc.xy(1, rowNb));
        TextFieldWithLanguage textFieldWithLanguage = new TextFieldWithLanguage(opening.getContent(),
                opening.getLang());
        openingHoursTfs.add(textFieldWithLanguage);
        builder.add(textFieldWithLanguage.getTextField(), cc.xy(3, rowNb));
        builder.addLabel(labels.getString("eag2012.commons.language"), cc.xy(5, rowNb));
        builder.add(textFieldWithLanguage.getLanguageBox(), cc.xy(7, rowNb));
        setNextRow();
    }
    if (errors.contains("openingHoursTfs")) {
        builder.add(createErrorLabel(labels.getString("eag2012.errors.openingHours")), cc.xy(1, rowNb));
        setNextRow();
    }

    if (repository.getTimetable().getClosing().size() == 0) {
        repository.getTimetable().getClosing().add(new Closing());
    }
    //        closingDatesTfs = new ArrayList<TextFieldWithLanguage>(repository.getTimetable().getClosing().size());
    //        for(Closing closing : repository.getTimetable().getClosing()) {
    //            builder.addLabel(labels.getString("eag2012.commons.closingDates"), cc.xy(1, rowNb));
    //            TextFieldWithLanguage textFieldWithLanguage = new TextFieldWithLanguage(closing.getContent(), closing.getLang());
    //            closingDatesTfs.add(textFieldWithLanguage);
    //            builder.add(textFieldWithLanguage.getTextField(), cc.xy(3, rowNb));
    //            builder.addLabel(labels.getString("eag2012.commons.language"), cc.xy (5, rowNb));
    //            builder.add(textFieldWithLanguage.getLanguageBox(), cc.xy(7, rowNb));
    //            setNextRow();
    //        }

    builder.addLabel(labels.getString("eag2012.commons.accessiblePublic") + "*", cc.xy(1, rowNb));
    if (repository.getAccess() != null
            && Arrays.asList(yesOrNo).contains(repository.getAccess().getQuestion())) {
        accessiblePublicCombo.setSelectedItem(repository.getAccess().getQuestion());
    }
    builder.add(accessiblePublicCombo, cc.xy(3, rowNb));
    setNextRow();
    builder.addLabel(labels.getString("eag2012.commons.disabledAccess") + "*", cc.xy(1, rowNb));
    if (repository.getAccessibility().size() > 0
            && Arrays.asList(yesOrNo).contains(repository.getAccessibility().get(0).getQuestion())) {
        facilitiesForDisabledCombo.setSelectedItem(repository.getAccessibility().get(0).getQuestion());
    }
    builder.add(facilitiesForDisabledCombo, cc.xy(3, rowNb));
    setNextRow();

    //        builder.addLabel(labels.getString("eag2012.yourinstitution.linkToHoldingsGuide"), cc.xy(1, rowNb));
    //        if(eag.getRelations() == null) {
    //            eag.setRelations(new Relations());
    //        }
    //        if(eag.getRelations().getResourceRelation().size() > 0) {
    //            refInstitutionHoldingsGuideTf = new JTextField(eag.getRelations().getResourceRelation().get(0).getHref());
    //            if(eag.getRelations().getResourceRelation().get(0).getRelationEntry() != null)
    //                refInstitutionHoldingsGuideTitleTf = new JTextField(eag.getRelations().getResourceRelation().get(0).getRelationEntry().getContent());
    //            else
    //                refInstitutionHoldingsGuideTitleTf = new JTextField();
    //        } else {
    //            refInstitutionHoldingsGuideTf = new JTextField();
    //            refInstitutionHoldingsGuideTitleTf = new JTextField();
    //        }
    //        builder.add(refInstitutionHoldingsGuideTf, cc.xy(3, rowNb));
    //        builder.addLabel(labels.getString("eag2012.commons.linkTitle"),             cc.xy (5, rowNb));
    //        builder.add(refInstitutionHoldingsGuideTitleTf, cc.xy(7, rowNb));
    //        setNextRow();
    //        if((StringUtils.isNotBlank(refInstitutionHoldingsGuideTf.getText()) && !StringUtils.startsWithAny(refInstitutionHoldingsGuideTf.getText(), webPrefixes)) || errors.contains("refInstitutionHoldingsGuideTf")) {
    //            builder.add(createErrorLabel(labels.getString("eag2012.errors.webpageProtocol")), cc.xy(1, rowNb));
    //            setNextRow();
    //        }
    //        }

    builder.addSeparator("", cc.xyw(1, rowNb, 7));
    setNextRow();

    JButton addRepositoryBtn = new ButtonTab(
            labels.getString("eag2012.yourinstitution.addRepositoryTabButton"));
    builder.add(addRepositoryBtn, cc.xy(1, rowNb));
    addRepositoryBtn.addActionListener(new AddRepositoryTabButton());

    JButton nextTabBtn = new ButtonTab(labels.getString("eag2012.commons.nextTab"));
    builder.add(nextTabBtn, cc.xy(5, rowNb));
    nextTabBtn.addActionListener(new NextTabBtnAction(eag, tabbedPane, model));

    setNextRow();
    JButton exitBtn = new ButtonTab(labels.getString("eag2012.commons.exit"));
    builder.add(exitBtn, cc.xy(1, rowNb));
    exitBtn.addActionListener(new ExitBtnAction(eag, tabbedPane, model));
    JButton saveBtn = new ButtonTab(labels.getString("eag2012.commons.save"));
    builder.add(saveBtn, cc.xy(5, rowNb));
    saveBtn.addActionListener(new SaveBtnAction(eag, tabbedPane, model));

    setNextRow();
    builder.addSeparator("", cc.xyw(1, rowNb, 7));
    setNextRow();
    JButton nextInstitutionTabBtn = new ButtonTab(labels.getString("eag2012.controls.nextInstitution"));
    nextInstitutionTabBtn.addActionListener(new NextInstitutionTabBtnAction(eag, tabbedPane, model));
    builder.add(nextInstitutionTabBtn, cc.xy(5, rowNb));

    // Define the change tab listener.
    this.removeChangeListener();
    this.tabbedPane.addChangeListener(new ChangeTabListener(this.eag, this.tabbedPane, this.model, 0));

    JPanel panel = builder.getPanel();
    KeyboardFocusManager.getCurrentKeyboardFocusManager()
            .addPropertyChangeListener(new FocusManagerListener(panel));
    return panel;
}

From source file:geovista.network.gui.NodeLinkView.java

protected void addControls(final JPanel jp) {

    // Satellite//from w ww . ja  v  a2  s . co  m
    // JComboBox modeBox = graphMouse.getModeComboBox();
    // modeBox.addItemListener(((DefaultModalGraphMouse)satellite.getGraphMouse()).getModeListener());

    // Control Panel
    jp.setBackground(Color.WHITE);
    jp.setLayout(new BorderLayout());
    jp.add(vv, BorderLayout.CENTER);
    JPanel control_panel = new JPanel(new GridLayout(5, 1));
    jp.add(control_panel, BorderLayout.EAST);

    // File_Layout Panel
    Class[] combos = getCombos();
    final JComboBox jcb = new JComboBox(combos);
    jcb.setRenderer(new DefaultListCellRenderer() {
        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            String valueString = value.toString();
            valueString = valueString.substring(valueString.lastIndexOf('.') + 1);
            return super.getListCellRendererComponent(list, valueString, index, isSelected, cellHasFocus);
        }
    });

    jcb.addActionListener(new LayoutChooser(jcb, vv));
    jcb.setSelectedItem(FRLayout.class);
    final Box file_layout_panel = Box.createVerticalBox();
    file_layout_panel.setBorder(BorderFactory.createTitledBorder("File_Layout"));
    final JComboBox graph_chooser = new JComboBox(g_names);
    graph_chooser.addActionListener(new GraphChooser(jcb));
    JPanel layoutPanel = new JPanel();
    jcb.setAlignmentX(Component.CENTER_ALIGNMENT);
    layoutPanel.add(jcb);
    graph_chooser.setAlignmentX(Component.CENTER_ALIGNMENT);
    layoutPanel.add(graph_chooser);
    file_layout_panel.add(layoutPanel);

    // Basic Operation Panel

    final ScalingControl scaler = new CrossoverScalingControl();

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });
    JButton reset = new JButton("reset");
    reset.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Layout<Integer, Number> layout = vv.getGraphLayout();
            layout.initialize();
            Relaxer relaxer = vv.getModel().getRelaxer();
            if (relaxer != null) {
                relaxer.stop();
                relaxer.prerelax();
                relaxer.relax();
            }
        }
    });

    // Tranform and picking part
    final DefaultModalGraphMouse<Integer, Number> graphMouse = new DefaultModalGraphMouse<Integer, Number>();
    vv.setGraphMouse(graphMouse);
    JComboBox modeBox = graphMouse.getModeComboBox();
    modeBox.addItemListener(((DefaultModalGraphMouse<Integer, Number>) vv.getGraphMouse()).getModeListener());

    JButton collapse = new JButton("Collapse");
    JButton expand = new JButton("Expand");

    final Box basic_panel = Box.createVerticalBox();
    basic_panel.setBorder(BorderFactory.createTitledBorder("Basic_Operation"));
    JPanel zoomPanel = new JPanel();
    // plus.setAlignmentX(Component.CENTER_ALIGNMENT);
    zoomPanel.add(plus);
    // minus.setAlignmentX(Component.CENTER_ALIGNMENT);
    zoomPanel.add(minus);
    // modeBox.setAlignmentX(Component.CENTER_ALIGNMENT);
    zoomPanel.add(modeBox);
    // reset.setAlignmentX(Component.CENTER_ALIGNMENT);
    zoomPanel.add(reset);
    // collapse.setAlignmentY(Component.CENTER_ALIGNMENT);
    zoomPanel.add(collapse);
    // expand.setAlignmentY(Component.CENTER_ALIGNMENT);
    zoomPanel.add(expand);

    basic_panel.add(zoomPanel);

    // Vertex Part
    String[] vertexScoreType = { "VertexScore", "Degree", "BarycenterScorer", "BetweennessCentrality",
            "ClosenessCentrality", "DistanceCentralityScorer", "EigenvectorCentrality" };
    final JComboBox vertexScoreList = new JComboBox(vertexScoreType);
    vertexScoreList.setSelectedIndex(0);

    vertexScoreList.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            // Renderer.VertexLabel.Position position =
            // (Renderer.VertexLabel.Position)e.getItem();
            // vv.getRenderer().getVertexLabelRenderer().setPosition(position);
            if (vertexScoreList.getSelectedIndex() == 0) {

                // vertexScores = new VertexScoreTransformer<Integer,
                // Double>(voltage_scores);
                // vv.getRenderContext().setVertexShapeTransformer(new
                // ConstantTransformer(null));
                // vssa.setScaling(false);
                vv.getRenderContext().setVertexLabelTransformer(nonvertexLabel);
                vv.repaint();
            }

            if (vertexScoreList.getSelectedIndex() == 1) {
                // vertexScores = new VertexScoreTransformer<Integer,
                // Double>(degreeScorer);
                /*
                 * vssa = new
                 * VertexShapeSizeAspect<Integer,Number>((Graph<Integer
                 * ,Number>)g, transformerDegree);
                 * vv.getRenderContext().setVertexShapeTransformer(vssa);
                 * vssa.setScaling(true);
                 */

                vv.getRenderContext().setVertexLabelTransformer(vertexLabelDegree);
                vv.repaint();
            }
            if (vertexScoreList.getSelectedIndex() == 2) {
                vssa = new VertexShapeSizeAspect<Integer, Number>((Graph<Integer, Number>) g,
                        transformerBarycenter);
                vv.getRenderContext().setVertexShapeTransformer(vssa);
                vssa.setScaling(true);
                vv.getRenderContext().setVertexLabelTransformer(vertexLabelBarycenter);
                vv.repaint();
            }

            if (vertexScoreList.getSelectedIndex() == 3) {

                // betweennessCentrality= new BetweennessCentrality(g);
                // voltages = new VertexScoreTransformer<Integer,
                // Double>(betweennessCentrality);
                vssa = new VertexShapeSizeAspect<Integer, Number>((Graph<Integer, Number>) g,
                        transformerBetweenness);
                vv.getRenderContext().setVertexShapeTransformer(vssa);
                vssa.setScaling(true);
                vv.getRenderContext().setVertexLabelTransformer(vertexLabelBetweenness);
                vv.repaint();
            }
            if (vertexScoreList.getSelectedIndex() == 4) {
                vssa = new VertexShapeSizeAspect<Integer, Number>((Graph<Integer, Number>) g,
                        transformerCloseness);
                vv.getRenderContext().setVertexShapeTransformer(vssa);
                vssa.setScaling(true);
                vv.getRenderContext().setVertexLabelTransformer(vertexLabelCloseness);
                vv.repaint();
            }
            if (vertexScoreList.getSelectedIndex() == 5) {
                vssa = new VertexShapeSizeAspect<Integer, Number>((Graph<Integer, Number>) g,
                        transformerDistanceCentrality);
                vv.getRenderContext().setVertexShapeTransformer(vssa);
                vssa.setScaling(true);
                vv.getRenderContext().setVertexLabelTransformer(vertexLabelDistanceCentrality);
                vv.repaint();
            }
            if (vertexScoreList.getSelectedIndex() == 6) {
                vssa = new VertexShapeSizeAspect<Integer, Number>((Graph<Integer, Number>) g,
                        transformerEigenvector);
                vv.getRenderContext().setVertexShapeTransformer(vssa);
                vssa.setScaling(true);
                vv.getRenderContext().setVertexLabelTransformer(vertexLabelEigenvector);
                vv.repaint();
            }

        }
    });
    // cb.setSelectedItem(Renderer.VertexLabel.Position.SE);

    /*
     * v_shape = new JCheckBox("shape by degree");
     * v_shape.addActionListener(this); v_size = new
     * JCheckBox("size by vertexScores"); v_size.addActionListener(this);
     * v_size.setSelected(true); v_aspect = new
     * JCheckBox("stretch by degree ratio");
     * v_aspect.addActionListener(this);
     */
    v_small = new JCheckBox("filter when degree < " + VertexDisplayPredicate.MIN_DEGREE);
    v_small.addActionListener(this);
    e_labels = new JCheckBox("show edge labels");
    e_labels.addActionListener(this);

    // Vertex Panel
    final Box vertex_panel = Box.createVerticalBox();
    vertex_panel.setBorder(BorderFactory.createTitledBorder("Vertices"));
    // vertex_panel.add(v_stroke);
    vertex_panel.add(vertexScoreList);
    // vertex_panel.add(v_degree_labels);
    /*
     * vertex_panel.add(v_shape); vertex_panel.add(v_size);
     * vertex_panel.add(v_aspect);
     */
    vertex_panel.add(v_small);

    // Edge Part
    final Box edge_panel = Box.createVerticalBox();
    edge_panel.setBorder(BorderFactory.createTitledBorder("Edges"));
    edge_panel.add(e_labels);

    final JToggleButton groupVertices = new JToggleButton("Group Clusters");
    // Create slider to adjust the number of edges to remove when clustering
    final JSlider edgeBetweennessSlider = new JSlider(JSlider.HORIZONTAL);
    edgeBetweennessSlider.setBackground(Color.WHITE);
    edgeBetweennessSlider.setPreferredSize(new Dimension(210, 50));
    edgeBetweennessSlider.setPaintTicks(true);
    edgeBetweennessSlider.setMaximum(g.getEdgeCount());
    edgeBetweennessSlider.setMinimum(0);
    edgeBetweennessSlider.setValue(0);
    edgeBetweennessSlider.setMajorTickSpacing(10);
    edgeBetweennessSlider.setPaintLabels(true);
    edgeBetweennessSlider.setPaintTicks(true);

    // Cluster Part
    final Box cluster_panel = Box.createVerticalBox();
    cluster_panel.setBorder(BorderFactory.createTitledBorder("Cluster"));
    cluster_panel.add(edgeBetweennessSlider);

    final String COMMANDSTRING = "Edges removed for clusters: ";
    final String eastSize = COMMANDSTRING + edgeBetweennessSlider.getValue();

    final TitledBorder sliderBorder = BorderFactory.createTitledBorder(eastSize);
    cluster_panel.setBorder(sliderBorder);
    cluster_panel.add(Box.createVerticalGlue());
    groupVertices.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            clusterAndRecolor(layout, edgeBetweennessSlider.getValue(), similarColors,
                    e.getStateChange() == ItemEvent.SELECTED);
            vv.repaint();
        }
    });

    clusterAndRecolor(layout, 0, similarColors, groupVertices.isSelected());

    edgeBetweennessSlider.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            JSlider source = (JSlider) e.getSource();
            if (!source.getValueIsAdjusting()) {
                int numEdgesToRemove = source.getValue();
                clusterAndRecolor(layout, numEdgesToRemove, similarColors, groupVertices.isSelected());
                sliderBorder.setTitle(COMMANDSTRING + edgeBetweennessSlider.getValue());
                cluster_panel.repaint();
                vv.validate();
                vv.repaint();
            }
        }
    });
    cluster_panel.add(groupVertices);

    control_panel.add(file_layout_panel);
    control_panel.add(vertex_panel);
    control_panel.add(edge_panel);
    control_panel.add(cluster_panel);
    control_panel.add(basic_panel);
}

From source file:com.declarativa.interprolog.gui.Ini2.java

private void graphComponents() throws IOException {

    Forest<String, Integer> forest = new DelegateForest<>();
    ObservableGraph g = new ObservableGraph(new BalloonLayoutDemo().createTree(forest));

    Layout layout = new BalloonLayout(forest);
    //Layout layout = new TreeLayout(forest, 70, 70);

    final BaseJungScene scene = new SceneImpl(g, layout);

    jLayeredPane1.setLayout(new BorderLayout());
    //jf.setLayout(new BorderLayout());

    jLayeredPane1.add(new JScrollPane(scene.createView()), BorderLayout.CENTER);
    //jf.add(new JScrollPane(scene.createView()), BorderLayout.CENTER);

    JToolBar bar = new JToolBar();
    bar.setMargin(new Insets(5, 5, 5, 5));
    bar.setLayout(new FlowLayout(5));
    DefaultComboBoxModel<Layout> mdl = new DefaultComboBoxModel<>();
    mdl.addElement(new KKLayout(g));
    mdl.addElement(layout);//  ww  w.j a va2 s  .c  o m
    mdl.addElement(new BalloonLayout(forest));
    mdl.addElement(new RadialTreeLayout(forest));
    mdl.addElement(new CircleLayout(g));
    mdl.addElement(new FRLayout(g));
    mdl.addElement(new FRLayout2(g));
    mdl.addElement(new ISOMLayout(g));
    mdl.addElement(new SpringLayout(g));
    mdl.addElement(new SpringLayout2(g));
    mdl.addElement(new DAGLayout(g));
    mdl.addElement(new XLayout(g));
    mdl.setSelectedItem(layout);
    final JCheckBox checkbox = new JCheckBox("Animate iterative layouts");

    scene.setLayoutAnimationFramesPerSecond(48);

    final JComboBox<Layout> layouts = new JComboBox(mdl);
    layouts.setRenderer(new DefaultListCellRenderer() {
        @Override
        public Component getListCellRendererComponent(JList<?> jlist, Object o, int i, boolean bln,
                boolean bln1) {
            o = o.getClass().getSimpleName();
            return super.getListCellRendererComponent(jlist, o, i, bln, bln1); //To change body of generated methods, choose Tools | Templates.
        }
    });
    bar.add(new JLabel(" Layout Type"));
    bar.add(layouts);
    layouts.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            Layout layout = (Layout) layouts.getSelectedItem();
            // These two layouts implement IterativeContext, but they do
            // not evolve toward anything, they just randomly rearrange
            // themselves.  So disable animation for these.
            if (layout instanceof ISOMLayout || layout instanceof DAGLayout) {
                checkbox.setSelected(false);
            }
            scene.setGraphLayout(layout, true);
        }
    });

    bar.add(new JLabel(" Connection Shape"));
    DefaultComboBoxModel<Transformer<Context<Graph<String, Number>, Number>, Shape>> shapes = new DefaultComboBoxModel<>();
    shapes.addElement(new EdgeShape.QuadCurve<String, Number>());
    shapes.addElement(new EdgeShape.BentLine<String, Number>());
    shapes.addElement(new EdgeShape.CubicCurve<String, Number>());
    shapes.addElement(new EdgeShape.Line<String, Number>());
    shapes.addElement(new EdgeShape.Box<String, Number>());
    shapes.addElement(new EdgeShape.Orthogonal<String, Number>());
    shapes.addElement(new EdgeShape.Wedge<String, Number>(10));

    final JComboBox<Transformer<Context<Graph<String, Number>, Number>, Shape>> shapesBox = new JComboBox<>(
            shapes);
    shapesBox.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent ae) {
            Transformer<Context<Graph<String, Number>, Number>, Shape> xform = (Transformer<Context<Graph<String, Number>, Number>, Shape>) shapesBox
                    .getSelectedItem();
            scene.setConnectionEdgeShape(xform);
        }
    });
    shapesBox.setRenderer(new DefaultListCellRenderer() {
        @Override
        public Component getListCellRendererComponent(JList<?> jlist, Object o, int i, boolean bln,
                boolean bln1) {
            o = o.getClass().getSimpleName();
            return super.getListCellRendererComponent(jlist, o, i, bln, bln1); //To change body of generated methods, choose Tools | Templates.
        }
    });
    shapesBox.setSelectedItem(new EdgeShape.QuadCurve<>());
    bar.add(shapesBox);

    //jf.add(bar, BorderLayout.NORTH);

    bar.add(new MinSizePanel(scene.createSatelliteView()));
    bar.setFloatable(false);
    bar.setRollover(true);

    final JLabel selectionLabel = new JLabel("<html>&nbsp;</html>");
    System.out.println("LOOKUP IS " + scene.getLookup());
    Lookup.Result<String> selectedNodes = scene.getLookup().lookupResult(String.class);
    LookupListener listener = new LookupListener() {
        @Override
        public void resultChanged(LookupEvent le) {
            System.out.println("RES CHANGED");
            Lookup.Result<String> res = (Lookup.Result<String>) le.getSource();
            StringBuilder sb = new StringBuilder("<html>");
            List<String> l = new ArrayList<>(res.allInstances());
            Collections.sort(l);
            for (String s : l) {
                if (sb.length() != 0) {
                    sb.append(", ");
                }
                sb.append(s);
            }
            sb.append("</html>");
            selectionLabel.setText(sb.toString());
            System.out.println("LOOKUP EVENT " + sb);
        }
    };
    selectedNodes.addLookupListener(listener);
    selectedNodes.allInstances();

    bar.add(selectionLabel);

    checkbox.setSelected(true);
    checkbox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            scene.setAnimateIterativeLayouts(checkbox.isSelected());
        }
    });
    bar.add(checkbox);
    jLayeredPane3.setLayout(new BorderLayout());

    jLayeredPane3.add(bar);
    //        jf.setSize(jf.getGraphicsConfiguration().getBounds().width - 120, 700);
    //        jf.setSize(new Dimension(1280, 720));
    //        jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

    this.addWindowListener(new WindowAdapter() {
        @Override
        public void windowOpened(WindowEvent we) {
            scene.relayout(true);
            scene.validate();
        }
    });

}