Example usage for javax.swing DefaultComboBoxModel DefaultComboBoxModel

List of usage examples for javax.swing DefaultComboBoxModel DefaultComboBoxModel

Introduction

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

Prototype

public DefaultComboBoxModel() 

Source Link

Document

Constructs an empty DefaultComboBoxModel object.

Usage

From source file:gtu._work.ui.DirectoryCompareUI.java

private JComboBox getDiffToolComboBox() {
    if (diffToolComboBox == null) {
        DefaultComboBoxModel diffToolComboBoxModel = new DefaultComboBoxModel();
        for (DiffMergeCommand e : DiffMergeCommand.values()) {
            diffToolComboBoxModel.addElement(e);
        }//w  w w. j  a v a  2s  .  c  om
        diffToolComboBox = new JComboBox();
        diffToolComboBox.setModel(diffToolComboBoxModel);
        diffToolComboBox.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                DiffMergeCommand e = (DiffMergeCommand) diffToolComboBox.getSelectedItem();
                if (e == DiffMergeCommand.StarTeam) {
                    String path = getStarTeamPath_FileCompareMerge(false);
                    if (StringUtils.isBlank(path)) {
                        try {
                            File file = JCommonUtil._jFileChooser_selectFileOnly();
                            if (file == null) {
                                Validate.isTrue(false, "!");
                            }
                            Validate.isTrue(
                                    StringUtils.equalsIgnoreCase("File Compare Merge.exe", file.getName()),
                                    "??File Compare Merge.exe");
                            String starTeamConfig = file.getCanonicalPath();

                            Properties prop = configBean.getConfigProp();
                            prop.setProperty(STARTEAM_KEY, starTeamConfig);
                            configBean.store();
                            JCommonUtil._jOptionPane_showMessageDialog_info("?!");
                        } catch (Exception ex) {
                            JCommonUtil.handleException(ex, false);
                        }
                    }
                }
            }
        });
    }
    return diffToolComboBox;
}

From source file:neg.JRViewerFactura.java

/** This method is called from within the constructor to
 * initialize the form.//  w ww  . ja  v  a 2 s .  c  o  m
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    tlbToolBar = new javax.swing.JPanel();
    btnSave = new javax.swing.JButton();
    btnPrint = new javax.swing.JButton();
    btnReload = new javax.swing.JButton();
    pnlSep01 = new javax.swing.JPanel();
    btnFirst = new javax.swing.JButton();
    btnPrevious = new javax.swing.JButton();
    btnNext = new javax.swing.JButton();
    btnLast = new javax.swing.JButton();
    txtGoTo = new javax.swing.JTextField();
    pnlSep02 = new javax.swing.JPanel();
    btnActualSize = new javax.swing.JToggleButton();
    btnFitPage = new javax.swing.JToggleButton();
    btnFitWidth = new javax.swing.JToggleButton();
    pnlSep03 = new javax.swing.JPanel();
    btnZoomIn = new javax.swing.JButton();
    btnZoomOut = new javax.swing.JButton();
    cmbZoom = new javax.swing.JComboBox();
    DefaultComboBoxModel model = new DefaultComboBoxModel();
    for (int i = 0; i < zooms.length; i++) {
        model.addElement("" + zooms[i] + "%");
    }
    cmbZoom.setModel(model);
    jButton1 = new javax.swing.JButton();
    jButtonMail = new javax.swing.JButton();
    pnlMain = new javax.swing.JPanel();
    scrollPane = new javax.swing.JScrollPane();
    scrollPane.getHorizontalScrollBar().setUnitIncrement(5);
    scrollPane.getVerticalScrollBar().setUnitIncrement(5);
    pnlInScroll = new javax.swing.JPanel();
    pnlPage = new javax.swing.JPanel();
    jPanel4 = new javax.swing.JPanel();
    pnlLinks = new javax.swing.JPanel();
    jPanel5 = new javax.swing.JPanel();
    jPanel6 = new javax.swing.JPanel();
    jPanel7 = new javax.swing.JPanel();
    jPanel8 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    jPanel9 = new javax.swing.JPanel();
    lblPage = new PageRenderer(this);
    pnlStatus = new javax.swing.JPanel();
    lblStatus = new javax.swing.JLabel();

    setMinimumSize(new java.awt.Dimension(450, 150));
    setPreferredSize(new java.awt.Dimension(450, 150));
    setLayout(new java.awt.BorderLayout());

    tlbToolBar.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 2));

    btnSave.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/save.GIF"))); // NOI18N
    btnSave.setToolTipText(getBundleString("save"));
    btnSave.setMargin(new java.awt.Insets(2, 2, 2, 2));
    btnSave.setMaximumSize(new java.awt.Dimension(23, 23));
    btnSave.setMinimumSize(new java.awt.Dimension(23, 23));
    btnSave.setPreferredSize(new java.awt.Dimension(23, 23));
    btnSave.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnSaveActionPerformed(evt);
        }
    });
    tlbToolBar.add(btnSave);

    btnPrint.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/print.GIF"))); // NOI18N
    btnPrint.setToolTipText(getBundleString("print"));
    btnPrint.setMargin(new java.awt.Insets(2, 2, 2, 2));
    btnPrint.setMaximumSize(new java.awt.Dimension(23, 23));
    btnPrint.setMinimumSize(new java.awt.Dimension(23, 23));
    btnPrint.setPreferredSize(new java.awt.Dimension(23, 23));
    btnPrint.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnPrintActionPerformed(evt);
        }
    });
    tlbToolBar.add(btnPrint);

    btnReload.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/reload.GIF"))); // NOI18N
    btnReload.setToolTipText(getBundleString("reload"));
    btnReload.setMargin(new java.awt.Insets(2, 2, 2, 2));
    btnReload.setMaximumSize(new java.awt.Dimension(23, 23));
    btnReload.setMinimumSize(new java.awt.Dimension(23, 23));
    btnReload.setPreferredSize(new java.awt.Dimension(23, 23));
    tlbToolBar.add(btnReload);

    pnlSep01.setMaximumSize(new java.awt.Dimension(10, 10));
    tlbToolBar.add(pnlSep01);

    btnFirst.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/first.GIF"))); // NOI18N
    btnFirst.setToolTipText(getBundleString("first.page"));
    btnFirst.setMargin(new java.awt.Insets(2, 2, 2, 2));
    btnFirst.setMaximumSize(new java.awt.Dimension(23, 23));
    btnFirst.setMinimumSize(new java.awt.Dimension(23, 23));
    btnFirst.setPreferredSize(new java.awt.Dimension(23, 23));
    btnFirst.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnFirstActionPerformed(evt);
        }
    });
    tlbToolBar.add(btnFirst);

    btnPrevious.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/net/sf/jasperreports/view/images/previous.GIF"))); // NOI18N
    btnPrevious.setToolTipText(getBundleString("previous.page"));
    btnPrevious.setMargin(new java.awt.Insets(2, 2, 2, 2));
    btnPrevious.setMaximumSize(new java.awt.Dimension(23, 23));
    btnPrevious.setMinimumSize(new java.awt.Dimension(23, 23));
    btnPrevious.setPreferredSize(new java.awt.Dimension(23, 23));
    btnPrevious.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnPreviousActionPerformed(evt);
        }
    });
    tlbToolBar.add(btnPrevious);

    btnNext.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/next.GIF"))); // NOI18N
    btnNext.setToolTipText(getBundleString("next.page"));
    btnNext.setMargin(new java.awt.Insets(2, 2, 2, 2));
    btnNext.setMaximumSize(new java.awt.Dimension(23, 23));
    btnNext.setMinimumSize(new java.awt.Dimension(23, 23));
    btnNext.setPreferredSize(new java.awt.Dimension(23, 23));
    btnNext.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnNextActionPerformed(evt);
        }
    });
    tlbToolBar.add(btnNext);

    btnLast.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/last.GIF"))); // NOI18N
    btnLast.setToolTipText(getBundleString("last.page"));
    btnLast.setMargin(new java.awt.Insets(2, 2, 2, 2));
    btnLast.setMaximumSize(new java.awt.Dimension(23, 23));
    btnLast.setMinimumSize(new java.awt.Dimension(23, 23));
    btnLast.setPreferredSize(new java.awt.Dimension(23, 23));
    btnLast.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnLastActionPerformed(evt);
        }
    });
    tlbToolBar.add(btnLast);

    txtGoTo.setToolTipText(getBundleString("go.to.page"));
    txtGoTo.setMaximumSize(new java.awt.Dimension(40, 23));
    txtGoTo.setMinimumSize(new java.awt.Dimension(40, 23));
    txtGoTo.setPreferredSize(new java.awt.Dimension(40, 23));
    txtGoTo.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            txtGoToActionPerformed(evt);
        }
    });
    tlbToolBar.add(txtGoTo);

    pnlSep02.setMaximumSize(new java.awt.Dimension(10, 10));
    tlbToolBar.add(pnlSep02);

    btnActualSize.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/net/sf/jasperreports/view/images/actualsize.GIF"))); // NOI18N
    btnActualSize.setToolTipText(getBundleString("actual.size"));
    btnActualSize.setMargin(new java.awt.Insets(2, 2, 2, 2));
    btnActualSize.setMaximumSize(new java.awt.Dimension(23, 23));
    btnActualSize.setMinimumSize(new java.awt.Dimension(23, 23));
    btnActualSize.setPreferredSize(new java.awt.Dimension(23, 23));
    btnActualSize.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnActualSizeActionPerformed(evt);
        }
    });
    tlbToolBar.add(btnActualSize);

    btnFitPage.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/fitpage.GIF"))); // NOI18N
    btnFitPage.setToolTipText(getBundleString("fit.page"));
    btnFitPage.setMargin(new java.awt.Insets(2, 2, 2, 2));
    btnFitPage.setMaximumSize(new java.awt.Dimension(23, 23));
    btnFitPage.setMinimumSize(new java.awt.Dimension(23, 23));
    btnFitPage.setPreferredSize(new java.awt.Dimension(23, 23));
    btnFitPage.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnFitPageActionPerformed(evt);
        }
    });
    tlbToolBar.add(btnFitPage);

    btnFitWidth.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/net/sf/jasperreports/view/images/fitwidth.GIF"))); // NOI18N
    btnFitWidth.setToolTipText(getBundleString("fit.width"));
    btnFitWidth.setMargin(new java.awt.Insets(2, 2, 2, 2));
    btnFitWidth.setMaximumSize(new java.awt.Dimension(23, 23));
    btnFitWidth.setMinimumSize(new java.awt.Dimension(23, 23));
    btnFitWidth.setPreferredSize(new java.awt.Dimension(23, 23));
    btnFitWidth.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnFitWidthActionPerformed(evt);
        }
    });
    tlbToolBar.add(btnFitWidth);

    pnlSep03.setMaximumSize(new java.awt.Dimension(10, 10));
    tlbToolBar.add(pnlSep03);

    btnZoomIn.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/zoomin.GIF"))); // NOI18N
    btnZoomIn.setToolTipText(getBundleString("zoom.in"));
    btnZoomIn.setMargin(new java.awt.Insets(2, 2, 2, 2));
    btnZoomIn.setMaximumSize(new java.awt.Dimension(23, 23));
    btnZoomIn.setMinimumSize(new java.awt.Dimension(23, 23));
    btnZoomIn.setPreferredSize(new java.awt.Dimension(23, 23));
    btnZoomIn.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnZoomInActionPerformed(evt);
        }
    });
    tlbToolBar.add(btnZoomIn);

    btnZoomOut.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/zoomout.GIF"))); // NOI18N
    btnZoomOut.setToolTipText(getBundleString("zoom.out"));
    btnZoomOut.setMargin(new java.awt.Insets(2, 2, 2, 2));
    btnZoomOut.setMaximumSize(new java.awt.Dimension(23, 23));
    btnZoomOut.setMinimumSize(new java.awt.Dimension(23, 23));
    btnZoomOut.setPreferredSize(new java.awt.Dimension(23, 23));
    btnZoomOut.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnZoomOutActionPerformed(evt);
        }
    });
    tlbToolBar.add(btnZoomOut);

    cmbZoom.setEditable(true);
    cmbZoom.setToolTipText(getBundleString("zoom.ratio"));
    cmbZoom.setMaximumSize(new java.awt.Dimension(80, 23));
    cmbZoom.setMinimumSize(new java.awt.Dimension(80, 23));
    cmbZoom.setPreferredSize(new java.awt.Dimension(80, 23));
    cmbZoom.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            cmbZoomActionPerformed(evt);
        }
    });
    cmbZoom.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            cmbZoomItemStateChanged(evt);
        }
    });
    tlbToolBar.add(cmbZoom);

    jButton1.setForeground(new java.awt.Color(255, 0, 0));
    jButton1.setText("Cancelar");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton1ActionPerformed(evt);
        }
    });
    tlbToolBar.add(jButton1);

    jButtonMail.setForeground(new java.awt.Color(255, 0, 0));
    jButtonMail.setText("Mail");
    jButtonMail.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButtonMailActionPerformed(evt);
        }
    });
    tlbToolBar.add(jButtonMail);

    add(tlbToolBar, java.awt.BorderLayout.NORTH);

    pnlMain.addComponentListener(new java.awt.event.ComponentAdapter() {
        public void componentResized(java.awt.event.ComponentEvent evt) {
            pnlMainComponentResized(evt);
        }
    });
    pnlMain.setLayout(new java.awt.BorderLayout());

    scrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    scrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

    pnlInScroll.setLayout(new java.awt.GridBagLayout());

    pnlPage.setMinimumSize(new java.awt.Dimension(100, 100));
    pnlPage.setPreferredSize(new java.awt.Dimension(100, 100));
    pnlPage.setLayout(new java.awt.BorderLayout());

    jPanel4.setMinimumSize(new java.awt.Dimension(100, 120));
    jPanel4.setPreferredSize(new java.awt.Dimension(100, 120));
    jPanel4.setLayout(new java.awt.GridBagLayout());

    pnlLinks.setMinimumSize(new java.awt.Dimension(5, 5));
    pnlLinks.setPreferredSize(new java.awt.Dimension(5, 5));
    pnlLinks.setOpaque(false);
    pnlLinks.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mousePressed(java.awt.event.MouseEvent evt) {
            pnlLinksMousePressed(evt);
        }

        public void mouseReleased(java.awt.event.MouseEvent evt) {
            pnlLinksMouseReleased(evt);
        }
    });
    pnlLinks.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
        public void mouseDragged(java.awt.event.MouseEvent evt) {
            pnlLinksMouseDragged(evt);
        }
    });
    pnlLinks.setLayout(null);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    jPanel4.add(pnlLinks, gridBagConstraints);

    jPanel5.setBackground(java.awt.Color.gray);
    jPanel5.setMinimumSize(new java.awt.Dimension(5, 5));
    jPanel5.setPreferredSize(new java.awt.Dimension(5, 5));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
    jPanel4.add(jPanel5, gridBagConstraints);

    jPanel6.setMinimumSize(new java.awt.Dimension(5, 5));
    jPanel6.setPreferredSize(new java.awt.Dimension(5, 5));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    jPanel4.add(jPanel6, gridBagConstraints);

    jPanel7.setBackground(java.awt.Color.gray);
    jPanel7.setMinimumSize(new java.awt.Dimension(5, 5));
    jPanel7.setPreferredSize(new java.awt.Dimension(5, 5));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    jPanel4.add(jPanel7, gridBagConstraints);

    jPanel8.setBackground(java.awt.Color.gray);
    jPanel8.setMinimumSize(new java.awt.Dimension(5, 5));
    jPanel8.setPreferredSize(new java.awt.Dimension(5, 5));

    jLabel1.setText("jLabel1");
    jPanel8.add(jLabel1);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 2;
    jPanel4.add(jPanel8, gridBagConstraints);

    jPanel9.setMinimumSize(new java.awt.Dimension(5, 5));
    jPanel9.setPreferredSize(new java.awt.Dimension(5, 5));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    jPanel4.add(jPanel9, gridBagConstraints);

    lblPage.setBackground(java.awt.Color.white);
    lblPage.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
    lblPage.setOpaque(true);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel4.add(lblPage, gridBagConstraints);

    pnlPage.add(jPanel4, java.awt.BorderLayout.CENTER);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    pnlInScroll.add(pnlPage, gridBagConstraints);

    scrollPane.setViewportView(pnlInScroll);

    pnlMain.add(scrollPane, java.awt.BorderLayout.CENTER);

    add(pnlMain, java.awt.BorderLayout.CENTER);

    pnlStatus.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 0, 0));

    lblStatus.setFont(new java.awt.Font("Dialog", 1, 10));
    lblStatus.setText("Page i of n");
    pnlStatus.add(lblStatus);

    add(pnlStatus, java.awt.BorderLayout.SOUTH);
}

From source file:org.fhaes.fhsamplesize.view.FHSampleSize.java

/**
 * Generate the SSIZAnalysisModel representing the data and parameters for this analysis.
 * /*from   w  ww .ja  va  2 s .  co m*/
 * @param model
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
public void populateFromAnalysisModel(SSIZAnalysisModel model) {

    DefaultComboBoxModel combomodel = new DefaultComboBoxModel();

    for (SegmentModel segment : model.getSegments())
        combomodel.addElement(segment);

    cboSegment.setModel(combomodel);
    cboSegment.setEnabled(model.getSegments().size() > 1);

    // cboSegment.setSelectedIndex(segmentsDone);
    cboChartMetric.setEnabled(true);
}

From source file:com.declarativa.interprolog.gui.Ini3.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);//w w 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();
        }
    });

}

From source file:com.mirth.connect.connectors.ws.WebServiceSender.java

private void getOperationsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_getOperationsButtonActionPerformed
    if (StringUtils.isNotBlank((String) serviceComboBox.getSelectedItem())
            || StringUtils.isNotBlank((String) portComboBox.getSelectedItem())
            || StringUtils.isNotBlank((String) locationURIComboBox.getSelectedItem())
            || !isDefaultOperations()) {
        if (!parent.alertOkCancel(parent,
                "This will replace your current service, port, location URI, and operation list. Press OK to continue.")) {
            return;
        }/*from   w ww .  j a v  a  2 s. c  o  m*/
    }

    // Reset all of the fields
    currentServiceMap = null;
    serviceComboBox.setModel(new DefaultComboBoxModel());
    portComboBox.setModel(new DefaultComboBoxModel());
    locationURIComboBox.setModel(new DefaultComboBoxModel());
    operationComboBox.setModel(new DefaultComboBoxModel(
            new String[] { WebServiceDispatcherProperties.WEBSERVICE_DEFAULT_DROPDOWN }));
    operationComboBox.setSelectedIndex(0);
    generateEnvelope.setEnabled(false);

    ResponseHandler handler = new ResponseHandler() {
        @Override
        public void handle(Object response) {
            ResponseHandler handler = new ResponseHandler() {
                @Override
                public void handle(Object response) {
                    if (response != null) {
                        currentServiceMap = (DefinitionServiceMap) response;
                        loadServiceMap();

                        if (currentServiceMap != null) {
                            serviceComboBox
                                    .setSelectedItem(currentServiceMap.getMap().keySet().iterator().next());
                        }

                        parent.setSaveEnabled(true);
                    }
                }
            };

            try {
                WebServiceDispatcherProperties props = (WebServiceDispatcherProperties) getFilledProperties();
                getServlet(WebServiceConnectorServletInterface.class,
                        "Retrieving cached WSDL definition map...",
                        "There was an error retrieving the cached WSDL definition map.\n\n", handler)
                                .getDefinition(getChannelId(), getChannelName(), props.getWsdlUrl(),
                                        props.getUsername(), props.getPassword());
            } catch (ClientException e) {
                // Should not happen
            }
        }
    };

    try {
        getServlet(WebServiceConnectorServletInterface.class, "Getting operations...",
                "Error caching WSDL. Please check the WSDL URL and authentication settings.\n\n", handler)
                        .cacheWsdlFromUrl(getChannelId(), getChannelName(),
                                (WebServiceDispatcherProperties) getFilledProperties());
    } catch (ClientException e) {
        // Should not happen
    }
}

From source file:com.openbravo.pos.sales.JRetailPanelTakeAway.java

private static DefaultComboBoxModel getSuggestedModel(java.util.List<String> list, String text) {
    DefaultComboBoxModel m = new DefaultComboBoxModel();
    for (String s : list) {
        // if(s.startsWith(text))
        m.addElement(s);/*from w  w w  .  j  a  v  a2 s  .c o m*/
    }
    return m;
}

From source file:com.openbravo.pos.sales.JRetailPanelTakeAway.java

private static DefaultComboBoxModel getCustNameSuggestedModel(java.util.List<String> list, String text) {
    DefaultComboBoxModel m = new DefaultComboBoxModel();
    for (String s : list) {

        // if(s.startsWith(text))
        String nameLength = cusName.getText();
        if (nameLength.length() > 2) {
            m.addElement(s);//w w  w.j a v  a  2s  .  c om
        }
    }
    return m;
}

From source file:com.openbravo.pos.sales.JRetailPanelTakeAway.java

private static DefaultComboBoxModel getContactNoSuggestedModel(java.util.List<String> list, String text) {
    DefaultComboBoxModel m = new DefaultComboBoxModel();
    for (String s : list) {
        String phoneLength = null;

        phoneLength = cusPhoneNo.getText();
        //    if(s.startsWith(text))
        if (phoneLength.length() > 5) {
            if (s.startsWith(text)) {
                m.addElement(s);/*ww  w  .  ja  va 2 s.  co m*/
            }
        }
    }
    return m;

}

From source file:com.openbravo.pos.sales.JRetailPanelTakeAway.java

private static DefaultComboBoxModel getItemSuggestedModel(java.util.List<String> list, String text) {
    DefaultComboBoxModel m = new DefaultComboBoxModel();
    for (String s : list) {
        String itemLength = null;

        itemLength = itemName.getText();
        // if(s.startsWith(text))
        if (itemLength.length() > 2) {
            //if(s.startsWith(text))
            m.addElement(s);/*from   w  w  w  . jav a2s. c o m*/
        }
    }
    return m;

}

From source file:ehospital.Principal.java

private void jMenuItem_agregar_paramedicosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem_agregar_paramedicosActionPerformed
    // TODO add your handling code here:
    DefaultComboBoxModel modelo = new DefaultComboBoxModel();
    for (int i = 0; i < lista_lugares.size(); i++) {
        if (lista_lugares.get(i).getTipo().contentEquals("Hospital")) {
            modelo.addElement(lista_lugares.get(i).getNombre());
        }/*from  w  w w  .j a v  a  2 s  .  com*/
    }
    cb_param_complejo.setModel(modelo);
    jd_paramedicos_agregar.setModal(true);
    jd_paramedicos_agregar.pack();
    jd_paramedicos_agregar.setVisible(true);
}