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(Vector<E> v) 

Source Link

Document

Constructs a DefaultComboBoxModel object initialized with a vector.

Usage

From source file:it.unibas.spicygui.vista.configuration.SettingEngineConfigurationDialog.java

private void initComponents() {

    buttonGroup = new javax.swing.ButtonGroup();
    okButton = new javax.swing.JButton();
    cancelButton = new javax.swing.JButton();
    checkRewriteCoverages = new javax.swing.JCheckBox();
    checkRewriteEDGs = new javax.swing.JCheckBox();
    checkRewriteSelfJoins = new javax.swing.JCheckBox();
    checkRewriteSubsumptions = new javax.swing.JCheckBox();
    checkUseCreateTableSTExchange = new javax.swing.JCheckBox();
    labelUseSortStrategy = new javax.swing.JLabel();
    comboBoxUseSortStrategy = new javax.swing.JComboBox();
    checkUseSkolemStrings = new javax.swing.JCheckBox();
    checkUseHashTextForSkolems = new javax.swing.JCheckBox();
    checkUseLocalSkolems = new javax.swing.JCheckBox();
    checkRewriteAllHomomorphisms = new javax.swing.JCheckBox();
    labelUseSkolemTableStrategy = new javax.swing.JLabel();
    comboBoxUseSkolemTableStrategy = new javax.swing.JComboBox();

    addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosing(java.awt.event.WindowEvent evt) {
            closeDialog(evt);// w  w  w  . j a  va  2 s.  co  m
        }
    });

    okButton.setText(org.openide.util.NbBundle.getMessage(Costanti.class, "Ok_button")); // NOI18N
    okButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            okButtonActionPerformed(evt);
        }
    });

    cancelButton.setText(org.openide.util.NbBundle.getMessage(Costanti.class, "Cancel_button")); // NOI18N
    cancelButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            cancelButtonActionPerformed(evt);
        }
    });

    checkRewriteCoverages
            .setText(org.openide.util.NbBundle.getMessage(Costanti.class, "check_RewriteCoverages_text")); // NOI18N

    checkRewriteEDGs.setText(org.openide.util.NbBundle.getMessage(Costanti.class, "check_RewriteEDGs_text")); // NOI18N

    checkRewriteSelfJoins
            .setText(org.openide.util.NbBundle.getMessage(Costanti.class, "check_RewriteSelfJoins_text")); // NOI18N

    checkRewriteSubsumptions
            .setText(org.openide.util.NbBundle.getMessage(Costanti.class, "check_RewriteSubsumptions_text")); // NOI18N

    checkUseCreateTableSTExchange.setText(
            org.openide.util.NbBundle.getMessage(Costanti.class, "check_UseCreateTableSTExchange_text")); // NOI18N
    checkUseCreateTableSTExchange.setEnabled(false);

    labelUseSortStrategy
            .setText(org.openide.util.NbBundle.getMessage(Costanti.class, "label_UseSortStrategy_text")); // NOI18N

    comboBoxUseSortStrategy.setModel(
            new DefaultComboBoxModel(new String[] { NbBundle.getMessage(Costanti.class, Costanti.COMBO_NO_SORT),
                    NbBundle.getMessage(Costanti.class, Costanti.COMBO_SORT),
                    NbBundle.getMessage(Costanti.class, Costanti.COMBO_AUTO_SORT) }));

    checkUseSkolemStrings
            .setText(org.openide.util.NbBundle.getMessage(Costanti.class, "check_UseSkolemStrings_text")); // NOI18N

    checkUseHashTextForSkolems
            .setText(org.openide.util.NbBundle.getMessage(Costanti.class, "check_UseHashTextForSkolem_text")); // NOI18N

    checkUseLocalSkolems.setLabel(org.openide.util.NbBundle.getMessage(SettingEngineConfigurationDialog.class,
            "SettingEngineConfigurationDialog.checkUseLocalSkolems.label")); // NOI18N

    checkRewriteAllHomomorphisms
            .setText(org.openide.util.NbBundle.getMessage(SettingEngineConfigurationDialog.class,
                    "SettingEngineConfigurationDialog.checkRewriteAllHomomorphisms.text")); // NOI18N

    labelUseSkolemTableStrategy.setText(org.openide.util.NbBundle.getMessage(Costanti.class,
            "SettingEngineConfigurationDialog.labelUseSkolemTableStrategy.text")); // NOI18N

    comboBoxUseSkolemTableStrategy.setModel(new DefaultComboBoxModel(
            new String[] { NbBundle.getMessage(Costanti.class, Costanti.COMBO_NO_SKOLEM_TABLE),
                    NbBundle.getMessage(Costanti.class, Costanti.COMBO_SKOLEM_TABLE),
                    NbBundle.getMessage(Costanti.class, Costanti.COMBO_AUTO_SKOLEM_TABLE) }));

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(checkRewriteSubsumptions).addComponent(checkRewriteSelfJoins)
                                    .addComponent(checkRewriteCoverages)
                                    .addComponent(checkRewriteAllHomomorphisms))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 55,
                                    Short.MAX_VALUE)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(checkUseCreateTableSTExchange,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 239,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(checkUseSkolemStrings)
                                    .addComponent(checkUseHashTextForSkolems).addComponent(checkRewriteEDGs))
                            .addGap(34, 34, 34))
                    .addGroup(layout.createSequentialGroup().addGroup(layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(checkUseLocalSkolems)
                            .addGroup(layout.createSequentialGroup().addComponent(labelUseSortStrategy)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(comboBoxUseSortStrategy,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 122,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(18, 18, 18).addComponent(labelUseSkolemTableStrategy)))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                            .addComponent(okButton, javax.swing.GroupLayout.PREFERRED_SIZE, 67,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(cancelButton))
                                    .addGroup(layout.createSequentialGroup()
                                            .addComponent(comboBoxUseSkolemTableStrategy,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 122,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(0, 0, Short.MAX_VALUE)))
                            .addContainerGap()))));

    layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] { cancelButton, okButton });

    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(checkRewriteSubsumptions).addComponent(checkUseCreateTableSTExchange))
                    .addGap(18, 18, 18)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(checkRewriteCoverages).addComponent(checkRewriteEDGs))
                    .addGap(18, 18, 18)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(checkRewriteSelfJoins).addComponent(checkUseSkolemStrings))
                    .addGap(18, 18, 18)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(checkRewriteAllHomomorphisms)
                            .addComponent(checkUseHashTextForSkolems))
                    .addGap(18, 18, 18)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(labelUseSkolemTableStrategy)
                                    .addComponent(comboBoxUseSkolemTableStrategy,
                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(comboBoxUseSortStrategy,
                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(labelUseSortStrategy)))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(checkUseLocalSkolems).addGap(18, 18, 18)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(okButton).addComponent(cancelButton))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    pack();
}

From source file:com.anrisoftware.prefdialog.fields.combobox.AbstractComboBoxField.java

/**
 * Sets the specified elements for this combo box fields.
 * /*from  w  ww.ja va2s .c o m*/
 * @param newElements
 *            the elements array to set.
 * 
 * @throws NullPointerException
 *             if the specified elements are {@code null}.
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
public void setElements(Object[] elements) {
    log.checkElements(this, elements);
    getComponent().setModel(new DefaultComboBoxModel(elements));
    log.elementsSet(this, elements);
}

From source file:com.microsoft.intellij.forms.CreateWebSiteForm.java

private void enableCustomJDK(boolean enable) {
    if (!enable) {
        try {//from  ww w . j ava 2  s .co  m
            String[] thrdPrtJdkArr = WindowsAzureProjectManager.getThirdPartyJdkNames(AzurePlugin.cmpntFile,
                    "");
            // check at least one element is present
            if (thrdPrtJdkArr.length >= 1) {
                jdkNames.setModel(new DefaultComboBoxModel(thrdPrtJdkArr));
                String valueToSet = "";
                valueToSet = WindowsAzureProjectManager.getFirstDefaultThirdPartyJdkName(AzurePlugin.cmpntFile);
                if (valueToSet.isEmpty()) {
                    valueToSet = thrdPrtJdkArr[0];
                }
                jdkNames.setSelectedItem(valueToSet);
            }
        } catch (WindowsAzureInvalidProjectOperationException ex) {
            log(ex.getMessage(), ex);
        }
    }
    jdkNames.setEnabled(enable);
}

From source file:com.floreantpos.ui.model.PizzaItemForm.java

private void initComponents() {
    setLayout(new BorderLayout());
    JLabel lblButtonColor = new JLabel(Messages.getString("MenuItemForm.19")); //$NON-NLS-1$
    tabbedPane = new javax.swing.JTabbedPane();

    JPanel tabGeneral = new javax.swing.JPanel();

    JLabel lblName = new JLabel();
    lblName.setHorizontalAlignment(SwingConstants.TRAILING);

    tfName = new com.floreantpos.swing.FixedLengthTextField(20);
    tfDescription = new JTextArea(new FixedLengthDocument(120));

    JLabel lTax = new javax.swing.JLabel();
    lTax.setHorizontalAlignment(SwingConstants.TRAILING);

    cbTax = new javax.swing.JComboBox();
    JButton btnNewTax = new javax.swing.JButton();

    JPanel tabShift = new javax.swing.JPanel();
    JPanel tabPrice = new javax.swing.JPanel();

    JPanel tabButtonStyle = new javax.swing.JPanel();
    JButton btnDeleteShift = new javax.swing.JButton();
    JButton btnAddShift = new javax.swing.JButton();

    JButton btnNewPrice = new javax.swing.JButton();
    JButton btnUpdatePrice = new javax.swing.JButton();
    JButton btnDeletePrice = new javax.swing.JButton();
    JButton btnDeleteAll = new javax.swing.JButton();
    JButton btnDefaultValue = new javax.swing.JButton();
    JButton btnAutoGenerate = new javax.swing.JButton();

    JScrollPane jScrollPane2 = new javax.swing.JScrollPane();
    JScrollPane priceTabScrollPane = new javax.swing.JScrollPane();

    shiftTable = new JTable();

    priceTable = new JTable();
    priceTable.setRowHeight(PosUIManager.getSize(priceTable.getRowHeight()));
    priceTable.setCellSelectionEnabled(true);
    priceTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    priceTable.setSurrendersFocusOnKeystroke(true);
    cbPrinterGroup = new JComboBox<PrinterGroup>(new DefaultComboBoxModel<PrinterGroup>(
            PrinterGroupDAO.getInstance().findAll().toArray(new PrinterGroup[0])));
    cbPrinterGroup.setPreferredSize(new Dimension(226, 0));

    tfDefaultSellPortion = new IntegerTextField(10);
    tfTranslatedName = new FixedLengthTextField(20);
    tfTranslatedName.setLength(120);/*from w ww  .  ja v a2  s.c o  m*/
    lblKitchenPrinter = new JLabel(Messages.getString("MenuItemForm.27")); //$NON-NLS-1$
    lblName.setText(Messages.getString("LABEL_NAME")); //$NON-NLS-1$
    tfName.setLength(120);
    JLabel lblTranslatedName = new JLabel(Messages.getString("MenuItemForm.lblTranslatedName.text")); //$NON-NLS-1$
    tfSortOrder = new IntegerTextField(20);
    tfSortOrder.setText(""); //$NON-NLS-1$
    cbTax.setPreferredSize(new Dimension(198, 0));
    btnButtonColor = new JButton(); //$NON-NLS-1$
    btnButtonColor.setPreferredSize(new Dimension(228, 40));
    JLabel lblTextColor = new JLabel(Messages.getString("MenuItemForm.lblTextColor.text")); //$NON-NLS-1$
    btnTextColor = new JButton(Messages.getString("MenuItemForm.SAMPLE_TEXT")); //$NON-NLS-1$
    cbShowTextWithImage = new JCheckBox(Messages.getString("MenuItemForm.40")); //$NON-NLS-1$
    cbShowTextWithImage.setActionCommand(Messages.getString("MenuItemForm.41")); //$NON-NLS-1$
    lTax.setText(Messages.getString("LABEL_TAX")); //$NON-NLS-1$
    btnNewTax.setText("...");
    lTax.setText(Messages.getString("LABEL_TAX")); //$NON-NLS-1$

    btnNewTax.setText("..."); //$NON-NLS-1$
    btnNewTax.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnNewTaxdoCreateNewTax(evt);
        }
    });

    tabbedPane.addTab(com.floreantpos.POSConstants.GENERAL, tabGeneral);
    tabbedPane.setPreferredSize(new Dimension(750, 470));

    tabbedPane.addTab(com.floreantpos.POSConstants.MODIFIER_GROUPS, getModifierGroupTab());

    btnAddShift.addActionListener(this);
    btnDeleteShift.addActionListener(this);

    tabGeneral.setLayout(new MigLayout("insets 20", "[][]20px[][]", "[][][][][][][][][][][][][]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    tabGeneral.add(lblName, "cell 0 1 ,right"); //$NON-NLS-1$
    tabGeneral.add(tfName, "cell 1 1,grow"); //$NON-NLS-1$

    tabGeneral.add(lblTranslatedName, "cell 0 2,right"); //$NON-NLS-1$
    tabGeneral.add(tfTranslatedName, "cell 1 2,grow");

    JLabel lgroup = new javax.swing.JLabel();
    lgroup.setHorizontalAlignment(SwingConstants.TRAILING);
    lgroup.setText(Messages.getString("LABEL_GROUP")); //$NON-NLS-1$

    tabGeneral.add(lgroup, "cell 0 3,alignx right"); //$NON-NLS-1$
    JLabel lblBarcode = new JLabel(Messages.getString("MenuItemForm.lblBarcode.text")); //$NON-NLS-1$

    tabGeneral.add(lblBarcode, "cell 0 4,alignx right"); //$NON-NLS-1$
    tfBarcode = new FixedLengthTextField(20);
    tabGeneral.add(tfBarcode, "cell 1 4,grow"); //$NON-NLS-1$
    JLabel lblStockCount = new JLabel(Messages.getString("MenuItemForm.17")); //$NON-NLS-1$

    tabGeneral.add(lblStockCount, "cell 0 5,alignx right"); //$NON-NLS-1$
    tfStockCount = new DoubleTextField(1);
    tabGeneral.add(tfStockCount, "cell 1 5,grow"); //$NON-NLS-1$
    chkVisible = new javax.swing.JCheckBox();

    tabGeneral.add(new JLabel("Default sell portion (%)"), "cell 0 6");
    tabGeneral.add(tfDefaultSellPortion, "cell 1 6,grow");

    chkVisible.setText(com.floreantpos.POSConstants.VISIBLE);
    chkVisible.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    chkVisible.setMargin(new java.awt.Insets(0, 0, 0, 0));

    tabGeneral.add(chkVisible, "cell 1 7");
    tabGeneral.add(lblKitchenPrinter, "cell 2 1,right"); //$NON-NLS-1$
    tabGeneral.add(cbPrinterGroup, "cell 3 1,grow"); //$NON-NLS-1$

    tabGeneral.add(lTax, "cell 2 2,right"); //$NON-NLS-1$
    tabGeneral.add(cbTax, "cell 3 2"); //$NON-NLS-1$
    tabGeneral.add(btnNewTax, "cell 3 2,grow"); //$NON-NLS-1$

    cbGroup = new javax.swing.JComboBox();
    cbGroup.setPreferredSize(new Dimension(198, 0));

    tabGeneral.add(cbGroup, "flowx,cell 1 3"); //$NON-NLS-1$
    JButton btnNewGroup = new javax.swing.JButton();

    btnNewGroup.setText("..."); //$NON-NLS-1$
    btnNewGroup.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            doCreateNewGroup(evt);
        }
    });
    tabGeneral.add(btnNewGroup, "cell 1 3"); //$NON-NLS-1$

    tabGeneral.add(new JLabel(Messages.getString("MenuItemForm.25")), "cell 2 3,right"); //$NON-NLS-1$ //$NON-NLS-2$
    orderList = new CheckBoxList();

    List<OrderType> orderTypes = Application.getInstance().getOrderTypes();
    orderList.setModel(orderTypes);

    JScrollPane orderCheckBoxList = new JScrollPane(orderList);
    orderCheckBoxList.setPreferredSize(new Dimension(228, 100));
    tabGeneral.add(orderCheckBoxList, "cell 3 3 3 3"); //$NON-NLS-1$
    cbDisableStockCount = new JCheckBox(Messages.getString("MenuItemForm.18")); //$NON-NLS-1$
    tabGeneral.add(cbDisableStockCount, "cell 1 8"); //$NON-NLS-1$

    tabGeneral.add(new JLabel(Messages.getString("MenuItemForm.29")), "cell 2 6,alignx right"); //$NON-NLS-1$ //$NON-NLS-2$
    JScrollPane scrlDescription = new JScrollPane(tfDescription, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrlDescription.setPreferredSize(new Dimension(228, 70));
    tfDescription.setLineWrap(true);
    tabGeneral.add(scrlDescription, "cell 3 6 3 3"); //$NON-NLS-1$

    add(tabbedPane);
    //TODO: 
    addRecepieExtension();

    btnDeleteShift.setText(com.floreantpos.POSConstants.DELETE_SHIFT);
    btnAddShift.setText(com.floreantpos.POSConstants.ADD_SHIFT);

    shiftTable
            .setModel(new javax.swing.table.DefaultTableModel(
                    new Object[][] { { null, null, null, null }, { null, null, null, null },
                            { null, null, null, null }, { null, null, null, null } },
                    new String[] { "Title 1", "Title 2", "Title 3", "Title 4" })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    jScrollPane2.setViewportView(shiftTable);

    org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(tabShift);
    tabShift.setLayout(jPanel3Layout);
    jPanel3Layout
            .setHorizontalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel3Layout.createSequentialGroup().addContainerGap(76, Short.MAX_VALUE)
                            .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane2,
                                            org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 670,
                                            org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(org.jdesktop.layout.GroupLayout.TRAILING,
                                            jPanel3Layout.createSequentialGroup().add(btnAddShift).add(5, 5, 5)
                                                    .add(btnDeleteShift)))
                            .addContainerGap()));
    jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup()
                    .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 345,
                            org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(btnAddShift).add(btnDeleteShift))
                    .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    tabbedPane.addTab(com.floreantpos.POSConstants.SHIFTS, tabShift);

    btnNewPrice.setText(Messages.getString("MenuItemForm.9")); //$NON-NLS-1$
    btnNewPrice.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            addNewPrice();
        }
    });
    btnUpdatePrice.setText(Messages.getString("MenuItemForm.13")); //$NON-NLS-1$
    btnUpdatePrice.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            updatePrice();
        }
    });
    btnDeletePrice.setText(Messages.getString("MenuItemForm.14")); //$NON-NLS-1$
    btnDeletePrice.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            deletePrice();
        }
    });

    btnAutoGenerate.setText("Auto Generate"); //$NON-NLS-1$
    btnAutoGenerate.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            autoGeneratePizzaItemSizeAndPrice();
        }
    });

    btnDeleteAll.setText(Messages.getString("MenuItemForm.15")); //$NON-NLS-1$
    btnDeleteAll.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            deleteAll();
        }
    });

    btnDefaultValue.setText(Messages.getString("MenuItemForm.7")); //$NON-NLS-1$
    priceTabScrollPane.setViewportView(priceTable);

    tabPrice.setLayout(new BorderLayout());
    tabPrice.add(priceTabScrollPane, BorderLayout.CENTER);

    JPanel buttonPanel = new JPanel();

    buttonPanel.add(btnNewPrice);
    buttonPanel.add(btnUpdatePrice);
    buttonPanel.add(btnDeletePrice);
    buttonPanel.add(btnAutoGenerate);

    tabPrice.add(buttonPanel, BorderLayout.SOUTH);
    tabGeneral.add(tabPrice, "cell 0 10,grow,span");
    tabbedPane.addChangeListener(this);

    tabButtonStyle.setLayout(new MigLayout("insets 10", "[][]100[][][][]", "[][][center][][][]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    JLabel lblImage = new JLabel(Messages.getString("MenuItemForm.28")); //$NON-NLS-1$
    lblImage.setHorizontalAlignment(SwingConstants.TRAILING);
    tabButtonStyle.add(lblImage, "cell 0 0,right"); //$NON-NLS-1$

    lblImagePreview = new JLabel(""); //$NON-NLS-1$
    lblImagePreview.setHorizontalAlignment(JLabel.CENTER);
    lblImagePreview.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    lblImagePreview.setPreferredSize(new Dimension(100, 100));
    tabButtonStyle.add(lblImagePreview, "cell 1 0"); //$NON-NLS-1$

    JButton btnSelectImage = new JButton("..."); //$NON-NLS-1$
    btnClearImage = new JButton(Messages.getString("MenuItemForm.34")); //$NON-NLS-1$
    tabButtonStyle.add(btnClearImage, "cell  1 0"); //$NON-NLS-1$
    tabButtonStyle.add(btnSelectImage, "cell 1 0"); //$NON-NLS-1$

    tabButtonStyle.add(lblButtonColor, "cell 0 2,right"); //$NON-NLS-1$
    tabButtonStyle.add(btnButtonColor, "cell 1 2,grow"); //$NON-NLS-1$
    tabButtonStyle.add(lblTextColor, "cell 0 3,right"); //$NON-NLS-1$
    tabButtonStyle.add(btnTextColor, "cell 1 3"); //$NON-NLS-1$
    tabButtonStyle.add(cbShowTextWithImage, "cell 1 4"); //$NON-NLS-1$

    btnTextColor.setPreferredSize(new Dimension(228, 50));

    btnSelectImage.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doSelectImageFile();
        }
    });

    btnClearImage.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doClearImage();
        }
    });

    btnButtonColor.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Color color = JColorChooser.showDialog(POSUtil.getBackOfficeWindow(),
                    Messages.getString("MenuItemForm.42"), btnButtonColor.getBackground()); //$NON-NLS-1$
            btnButtonColor.setBackground(color);
            btnTextColor.setBackground(color);
        }
    });

    btnTextColor.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Color color = JColorChooser.showDialog(POSUtil.getBackOfficeWindow(),
                    Messages.getString("MenuItemForm.43"), btnTextColor.getForeground()); //$NON-NLS-1$
            btnTextColor.setForeground(color);
        }
    });

    tabbedPane.addTab(Messages.getString("MenuItemForm.26"), tabButtonStyle); //$NON-NLS-1$
}

From source file:net.lmxm.ute.gui.editors.tasks.SubversionExportTaskEditorPanel.java

@Override
public void initialize(final Configuration configuration) {
    super.initialize(configuration);

    getSubversionDepthComboBox().setModel(new DefaultComboBoxModel(SubversionDepth.values()));
}

From source file:com.anrisoftware.prefdialog.fields.combobox.AbstractComboBoxField.java

/**
 * Sets the specified elements for this combo box fields.
 * /*w ww  .  j a va 2s .  c om*/
 * @param elements
 *            the {@link List} elements to set.
 * 
 * @throws NullPointerException
 *             if the specified elements are {@code null}.
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
public void setElements(Iterable<?> elements) {
    log.checkElements(this, elements);
    getComponent().setModel(new DefaultComboBoxModel(asList(elements)));
    log.elementsSet(this, elements);
}

From source file:com.projity.dialog.AbstractDialog.java

public static ComboBoxModel getComboBoxModel(String fieldId) {
    Object[] options = FieldDictionary.getInstance().getFieldFromId(fieldId).getOptions(null);
    return new DefaultComboBoxModel(options);
}

From source file:net.sf.jabref.gui.FileListEntryEditor.java

private void setValues(FileListEntry entry) {
    description.setText(entry.description);
    link.setText(entry.link);/*from  ww  w .  j av a  2 s  . c o  m*/
    //if (link.getText().length() > 0)
    //    checkExtension();
    Collection<ExternalFileType> list = ExternalFileTypes.getInstance().getExternalFileTypeSelection();

    types.setModel(new DefaultComboBoxModel<>(list.toArray(new ExternalFileType[list.size()])));
    types.setSelectedIndex(-1);
    // See what is a reasonable selection for the type combobox:
    if ((entry.type.isPresent()) && !(entry.type.get() instanceof UnknownExternalFileType)) {
        types.setSelectedItem(entry.type.get());
    } else if ((entry.link != null) && (!entry.link.isEmpty())) {
        checkExtension();
    }
}

From source file:com.microsoft.intellij.forms.CreateWebSiteForm.java

private void enableCustomJDKUser(boolean enable) {
    customUrl.setEnabled(enable);/*  w  ww .jav a  2  s .c o  m*/
    storageNames.setEnabled(enable);
    if (!enable) {
        customUrl.setText("");
        String[] storageAccs = JdkSrvConfig.getStrgAccoNamesAsPerTab(null, false);
        if (storageAccs.length >= 1) {
            storageNames.setModel(new DefaultComboBoxModel(storageAccs));
            storageNames.setSelectedItem(storageAccs[0]);
        }
    }
}

From source file:com.cch.aj.entryrecorder.frame.EntryJFrame.java

private int FillMachineComboBox(JComboBox comboBox, int id) {
    int result = -1;
    List<Machine> machines = this.machineService.GetAllEntities();
    if (machines.size() > 0) {
        List<ComboBoxItem<Machine>> machineNames = machines.stream().sorted(comparing(x -> x.getMachineNo()))
                .map(x -> ComboBoxItemConvertor.ConvertToComboBoxItem(x, x.getMachineNo(), x.getId()))
                .collect(Collectors.toList());
        Machine machine = new Machine();
        machine.setId(0);/*from   w w  w .j  ava  2  s  .  c  o  m*/
        machine.setMachineNo("- Select -");
        machineNames.add(0, new ComboBoxItem<Machine>(machine, machine.getMachineNo(), machine.getId()));
        ComboBoxItem[] machineNamesArray = machineNames.toArray(new ComboBoxItem[machineNames.size()]);
        comboBox.setModel(new DefaultComboBoxModel(machineNamesArray));
        if (id != 0) {
            ComboBoxItem<Machine> currentMachineName = machineNames.stream().filter(x -> x.getId() == id)
                    .findFirst().get();
            result = machineNames.indexOf(currentMachineName);
        } else {
            result = 0;
        }
        comboBox.setSelectedIndex(result);
    }
    return result;
}