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:com.orange.atk.graphAnalyser.LectureJATKResult.java

/** Creates new form NewJFrame */
public LectureJATKResult() {
    listModel = new DefaultListModel();
    listModelMarker = new DefaultListModel();
    comboModelLeft = new DefaultComboBoxModel();
    comboModelRight = new DefaultComboBoxModel();
    analyzerGraphs = new CreateGraph();
    chartPanel = analyzerGraphs.getChartpanel();
    analyzerGraphs.getJfreechart().addChangeListener(this);
    analyzerGraphs.getJfreechart().addProgressListener(this);
    chartPanel.setDomainZoomable(true);// w  w  w . j a  va 2  s .c om
    chartPanel.setRangeZoomable(true);
    chartPanel.setAutoscrolls(true);
    frame = this;
    //init model table
    int SERIES_COUNT = 1;
    this.modeltable = new DemoTableModel(SERIES_COUNT);
    for (int row = 0; row < SERIES_COUNT; row++) {
        this.modeltable.setValueAt("", row, 0);
        this.modeltable.setValueAt(new Double("0"), row, 1);
        this.modeltable.setValueAt(new Double("0"), row, 2);
        this.modeltable.setValueAt(new Double("0"), row, 3);

    }

    initComponents();

    jTable2.getColumnModel().getColumn(0).setCellRenderer(new ColorRenderertext());
    jListGraph.setCellRenderer(new MyCellRenderer());
    jComboBoxLeft.setRenderer(new MyCellRenderer());
    jComboBoxRight.setRenderer(new MyCellRenderer());

}

From source file:co.com.soinsoftware.hotelero.view.JFRoomPayment.java

private void setRoomModel() {
    this.invoiceList = this.invoiceController.selectNotEnabled();
    final DefaultComboBoxModel<String> model = new DefaultComboBoxModel<String>();
    model.addElement("Seleccione uno...");
    for (final Invoice invoice : this.invoiceList) {
        final Room room = invoice.getRoom();
        model.addElement(room.getName());
    }/*from   w w w  .ja va2s  . c  o  m*/
    this.jcbRoom.setModel(model);
}

From source file:com.microsoft.azure.hdinsight.spark.common.SparkSubmitModel.java

public SparkSubmitModel(@NotNull Project project) {
    this.cachedClusterDetails = new ArrayList();
    this.project = project;

    this.clusterComboBoxModel = new DefaultComboBoxModel<>();
    this.artifactComboBoxModel = new DefaultComboBoxModel<>();
    this.submissionParameter = submissionParameterMap.get(project);
    this.advancedConfigModel = submissionAdvancedConfigModelMap.get(project);

    final List<Artifact> artifacts = ArtifactUtil.getArtifactWithOutputPaths(project);

    for (Artifact artifact : artifacts) {
        artifactHashMap.put(artifact.getName(), artifact);
        artifactComboBoxModel.addElement(artifact.getName());
        if (artifactComboBoxModel.getSize() == 0) {
            artifactComboBoxModel.setSelectedItem(artifact.getName());
        }/*from  ww  w .jav  a 2  s . c  o m*/
    }

    int index = submissionParameter != null
            ? artifactComboBoxModel.getIndexOf(submissionParameter.getArtifactName())
            : -1;
    if (index != -1) {
        artifactComboBoxModel.setSelectedItem(submissionParameter.getArtifactName());
    }

    initializeTableModel(tableModel);
}

From source file:net.sf.mzmine.modules.peaklistmethods.peakpicking.adap3decompositionV1_5.ADAP3DecompositionV1_5SetupDialog.java

@Override
protected void addDialogComponents() {
    super.addDialogComponents();

    comboPeakList = new JComboBox<>();
    comboClustersModel = new DefaultComboBoxModel<>();
    comboClusters = new JComboBox<>(comboClustersModel);
    retTimeMZPlot = new SimpleScatterPlot("Retention time", "m/z");
    retTimeIntensityPlot = new EICPlot();

    PeakList[] peakLists = MZmineCore.getDesktop().getSelectedPeakLists();

    // -----------------------------
    // Panel with preview parameters
    // -----------------------------

    preview = new JCheckBox("Show preview");
    preview.addActionListener(this);
    preview.setHorizontalAlignment(SwingConstants.CENTER);

    if (peakLists == null || peakLists.length == 0)
        preview.setEnabled(false);/*from   w  w  w. j a v a 2s  . c om*/
    else
        preview.setEnabled(true);

    final JPanel previewPanel = new JPanel(new BorderLayout());
    previewPanel.add(new JSeparator(), BorderLayout.NORTH);
    previewPanel.add(preview, BorderLayout.CENTER);
    previewPanel.add(Box.createVerticalStrut(10), BorderLayout.SOUTH);

    comboPeakList.setFont(COMBO_FONT);
    for (final PeakList peakList : peakLists)
        if (peakList.getNumberOfRawDataFiles() == 1)
            comboPeakList.addItem(peakList);
    comboPeakList.addActionListener(this);

    comboClusters.setFont(COMBO_FONT);
    comboClusters.addActionListener(this);

    pnlLabelsFields = GUIUtils.makeTablePanel(2, 2, new JComponent[] { new JLabel("Peak list"), comboPeakList,
            new JLabel("Cluster list"), comboClusters });

    pnlVisible = new JPanel(new BorderLayout());
    pnlVisible.add(previewPanel, BorderLayout.NORTH);

    // --------------------------------------------------------------------
    // ----- Tabbed panel with plots --------------------------------------
    // --------------------------------------------------------------------

    //        pnlTabs = new JTabbedPane();
    pnlTabs = new JPanel();
    pnlTabs.setLayout(new BoxLayout(pnlTabs, BoxLayout.Y_AXIS));

    retTimeMZPlot.setMinimumSize(MIN_DIMENSIONS);

    JPanel pnlPlotRetTimeClusters = new JPanel(new BorderLayout());
    pnlPlotRetTimeClusters.setBackground(Color.white);
    pnlPlotRetTimeClusters.add(retTimeMZPlot, BorderLayout.CENTER);
    GUIUtils.addMarginAndBorder(pnlPlotRetTimeClusters, 10);

    pnlTabs.add(pnlPlotRetTimeClusters);

    retTimeIntensityPlot.setMinimumSize(MIN_DIMENSIONS);

    JPanel pnlPlotShapeClusters = new JPanel(new BorderLayout());
    pnlPlotShapeClusters.setBackground(Color.white);
    pnlPlotShapeClusters.add(retTimeIntensityPlot, BorderLayout.CENTER);
    GUIUtils.addMarginAndBorder(pnlPlotShapeClusters, 10);

    pnlTabs.add(pnlPlotShapeClusters);

    super.mainPanel.add(pnlVisible, 0, super.getNumberOfParameters() + 3, 2, 1, 0, 0,
            GridBagConstraints.HORIZONTAL);
}

From source file:br.upe.ecomp.dosa.view.wizard.WizardAction.java

private void addAlgorithms() {
    algorithmComboBox.setModel(new DefaultComboBoxModel());
    algorithmComboBox.addItem("");
    for (Class<? extends Algorithm> algorithm : applicationContext.getAlgorithmList()) {
        try {/*from  w  w  w.j a  v a2s.  co m*/
            algorithmComboBox.addItem(algorithm.getConstructors()[0].newInstance());
        } catch (IllegalArgumentException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (SecurityException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (InstantiationException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

From source file:com.lfv.lanzius.application.phoneonly.PhoneOnlyView.java

public void updateStructure() {
    DefaultComboBoxModel dcb_model = new DefaultComboBoxModel();

    String firstRole = "";
    // Roles// w  w  w. j ava2s  .co  m
    dcb_model = new DefaultComboBoxModel();
    synchronized (lock) {
        @SuppressWarnings("rawtypes")
        Iterator iter = model.getRootElement().getChild("RoleSetup").getChildren().iterator();
        while (iter.hasNext()) {
            Element er = (Element) iter.next();
            int roleId = DomTools.getAttributeInt(er, "id", 0, false);
            if (roleId > 0) {
                SlimRoleItem item = new SlimRoleItem(er);
                if (firstRole.length() == 0) {
                    firstRole = item.toString();
                }
                dcb_model.addElement(item);
            }
        }
    }
    phoneOnlyContentPane.setRole(firstRole);
    //contentPane.getRoleJLabel().setModel(dcb_model);

    // Peers
    updatePeerStructure();

    // Update and repaint
    updateIndicators();
    ((JPanel) phoneOnlyContentPane).revalidate();
    ((JPanel) phoneOnlyContentPane).repaint();
}

From source file:co.com.soinsoftware.hotelero.view.JFRoomService.java

private void setServiceTypeModel() {
    this.serviceTypeList = serviceTypeController.select();
    final DefaultComboBoxModel<String> model = new DefaultComboBoxModel<String>();
    model.addElement("Seleccione uno...");
    for (final ServiceType serviceType : this.serviceTypeList) {
        model.addElement(serviceType.getName());
    }/*w  w  w .j  a v  a2  s  .c  o m*/
    this.jcbServiceCategory.setModel(model);
}

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

private void initGUI() {
    try {// w  ww  . j a  v a2 s  . c o  m
        DocumentListener docListener = JCommonUtil.getDocumentListener(new HandleDocumentEvent() {
            public void process(DocumentEvent event) {
                jText1OrJArea1Change(event);
            }
        });

        BorderLayout thisLayout = new BorderLayout();
        getContentPane().setLayout(thisLayout);
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        {
            jTabbedPane1 = new JTabbedPane();
            jTabbedPane1.addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent e) {
                    jText1OrJArea1Change(null);
                }
            });
            getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
            {
                jPanel1 = new JPanel();
                BorderLayout jPanel1Layout = new BorderLayout();
                jPanel1.setLayout(jPanel1Layout);
                jTabbedPane1.addTab("src text", null, jPanel1, null);
                {
                    jScrollPane1 = new JScrollPane();
                    jPanel1.add(jScrollPane1, BorderLayout.CENTER);
                    {
                        srcArea = new JTextArea();
                        jScrollPane1.setViewportView(srcArea);
                        srcArea.setBorder(
                                BorderFactory.createMatteBorder(1, 1, 1, 1, new java.awt.Color(0, 0, 0)));
                        JCommonUtil.setFont(srcArea);
                        srcArea.addKeyListener(new KeyAdapter() {
                            @Override
                            public void keyPressed(KeyEvent e) {
                                jText1OrJArea1Change(null);
                            }
                        });
                    }
                }
            }
            {
                jPanel2 = new JPanel();
                BorderLayout jPanel2Layout = new BorderLayout();
                jPanel2.setLayout(jPanel2Layout);
                jTabbedPane1.addTab("group", null, jPanel2, null);
                {
                    jScrollPane2 = new JScrollPane();
                    jPanel2.add(jScrollPane2, BorderLayout.CENTER);
                    jScrollPane2.setPreferredSize(new java.awt.Dimension(398, 234));
                    {
                        ListModel groupListModel = new DefaultComboBoxModel();
                        groupList = new JList();
                        jScrollPane2.setViewportView(groupList);
                        groupList.setBorder(
                                BorderFactory.createMatteBorder(1, 1, 1, 1, new java.awt.Color(0, 0, 0)));
                        groupList.setModel(groupListModel);
                        JCommonUtil.setFont(groupList);
                    }
                }
                {
                    regexText0 = new JTextField();
                    jPanel2.add(regexText0, BorderLayout.NORTH);
                    regexText0.setBorder(
                            BorderFactory.createMatteBorder(1, 1, 1, 1, new java.awt.Color(0, 0, 0)));
                    JCommonUtil.setFont(regexText0);
                    regexText0.getDocument().addDocumentListener(docListener);
                }
            }
            {
                jPanel3 = new JPanel();
                BorderLayout jPanel3Layout = new BorderLayout();
                jPanel3.setLayout(jPanel3Layout);
                jTabbedPane1.addTab("scanner", null, jPanel3, null);
                {
                    jScrollPane3 = new JScrollPane();
                    jPanel3.add(jScrollPane3, BorderLayout.CENTER);
                    {
                        ListModel scannerListModel = new DefaultComboBoxModel();
                        scannerList = new JList();
                        jScrollPane3.setViewportView(scannerList);
                        scannerList.setBorder(
                                BorderFactory.createMatteBorder(1, 1, 1, 1, new java.awt.Color(0, 0, 0)));
                        scannerList.setModel(scannerListModel);
                        JCommonUtil.setFont(scannerList);
                    }
                }
                {
                    regexText = new JTextField();
                    jPanel3.add(regexText, BorderLayout.NORTH);
                    regexText.setBorder(
                            BorderFactory.createMatteBorder(1, 1, 1, 1, new java.awt.Color(0, 0, 0)));
                    JCommonUtil.setFont(regexText);
                    regexText.getDocument().addDocumentListener(docListener);
                }
            }
        }
        this.setTitle("\u6b63\u5247\u8868\u793a\u5f0f");
        this.setSize(419, 320);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:co.com.soinsoftware.hotelero.view.JFRoomDetail.java

private void setCompanyModel(final List<Company> companyList) {
    final DefaultComboBoxModel<String> model = new DefaultComboBoxModel<String>();
    model.addElement("Ninguna");
    for (final Company company : companyList) {
        model.addElement(company.getName());
    }/*from www  .  jav a 2 s  .  c  o  m*/
    this.jcbCompany.setModel(model);
}

From source file:co.com.soinsoftware.hotelero.view.JFRoomPayment.java

private void setInvoiceStatusModel() {
    final InvoiceStatus statusNoPaid = invoiceStatusController.selectNoPaid();
    final InvoiceStatus statusPaid = invoiceStatusController.selectPaid();
    this.invoiceStatusList = new ArrayList<>();
    this.invoiceStatusList.add(statusNoPaid);
    this.invoiceStatusList.add(statusPaid);
    final DefaultComboBoxModel<String> model = new DefaultComboBoxModel<String>();
    for (final InvoiceStatus invoiceStatus : this.invoiceStatusList) {
        model.addElement(invoiceStatus.getName());
    }// w ww  . ja  va  2  s.c  o m
    this.jcbAccountState.setModel(model);
}