Package javax.swing

Examples of javax.swing.ComboBoxModel


                    addEditor();
                } else {
                    removeEditor();
                }
            } else if (StringConstants.MODEL_PROPERTY_CHANGED.equals(event.getPropertyName())) {
                ComboBoxModel newModel = (ComboBoxModel)event.getNewValue();
                listBox.setModel(newModel);
                comboBox.configureEditor(comboBox.getEditor(), newModel.getSelectedItem());

                ComboBoxModel oldModel = (ComboBoxModel)event.getOldValue();
                oldModel.removeListDataListener(listDataListener);
                newModel.addListDataListener(listDataListener);
            } else if (StringConstants.COMPONENT_ORIENTATION.equals(event.getPropertyName())) {
                listBox.setComponentOrientation((ComponentOrientation) event.getNewValue());
            } else if (StringConstants.EXTENDED_SUPPORT_ENABLED_PROPERTY
                    .equals(event.getPropertyName())) {
View Full Code Here


      catch (Exception e)
      {
        // can be ignored ..
        logger.debug("Unable to determine file type. This is not fatal.", e);
      }
      final ComboBoxModel comboBoxModel = createLocationModel(selectedView);
      this.locationCombo.setModel(comboBoxModel);
      this.table.setSelectedPath((FileObject) comboBoxModel.getSelectedItem());
    }
    else
    {
      this.fileNameTextField.setText(null);
      this.table.setSelectedPath(null);
View Full Code Here

    return editor;
  }

  @Override
  public Object getWidgetValue() {
    ComboBoxModel model = ((JComboBox) adaptable.getWidget()).getModel();
    int size = model.getSize();
    String items = ""; //$NON-NLS-1$
    for (int i = 0; i < size; i++) {
      if (i == 0)
        items += model.getElementAt(i);
      else
        items += ", " + model.getElementAt(i); //$NON-NLS-1$
    }
    return items;
  }
View Full Code Here

  public void test(TestHarness harness
  {
    MyFileChooser fc = new MyFileChooser();
    MyMetalFileChooserUI ui = new MyMetalFileChooserUI(fc);
    fc.setUI(ui);
    ComboBoxModel m = ui.createFilterComboBoxModel();
    harness.check(m.getSize(), 1);
    harness.check(m.getElementAt(0), fc.getFileFilter());
   
    ComboBoxModel m2 = ui.createFilterComboBoxModel();
    harness.check(m != m2);
  }
View Full Code Here

   * @param lpi the lines per inch.
   */
  public void setLinesPerInch(final float lpi)
  {
    final Float lpiObj = new Float(lpi);
    final ComboBoxModel model = cbLinesPerInch.getModel();
    for (int i = 0; i < model.getSize(); i++)
    {
      if (lpiObj.equals(model.getElementAt(i)))
      {
        cbLinesPerInch.setSelectedIndex(i);
        return;
      }
    }
View Full Code Here

   * @param cpi the characters per inch.
   */
  public void setCharsPerInch(final float cpi)
  {
    final Float cpiObj = new Float(cpi);
    final ComboBoxModel model = cbCharsPerInch.getModel();
    for (int i = 0; i < model.getSize(); i++)
    {
      if (cpiObj.equals(model.getElementAt(i)))
      {
        cbCharsPerInch.setSelectedIndex(i);
        return;
      }
    }
View Full Code Here

            }
        }
        for (Entry<String, String> entry : map.entrySet()) {
            langsMap.put(entry.getValue(),entry.getKey());
        }                       
        ComboBoxModel model = new DefaultComboBoxModel(map.keySet().toArray());
        model.setSelectedItem(langsMap.get(lang));
        return model;
    }
View Full Code Here

    public static ComboBoxModel getLooksAndFeelsModel() {
        List<String> list = new ArrayList<String>();
        for (UIManager.LookAndFeelInfo lafInfo:UIManager.getInstalledLookAndFeels()) {
            list.add(lafInfo.getName());
        }
        ComboBoxModel model = new DefaultComboBoxModel(list.toArray());
        if (lookAndFeel!=null && list.contains(lookAndFeel)) {
            model.setSelectedItem(lookAndFeel);
        }
        return model;
    }
View Full Code Here

    /**
     * Creates the actual Swing JComboBox
     */
    public void create() {
        ComboBoxModel comboBoxModel = getComboBoxModel();
        /*if (!getModel().getObjectList().hasList()) {
            setVector(new StringVector("...", ""));
        } */

        //ObjectList objectList = getModel().getObjectList();
View Full Code Here

                    addEditor();
                } else {
                    removeEditor();
                }
            } else if (StringConstants.MODEL_PROPERTY_CHANGED.equals(event.getPropertyName())) {
                ComboBoxModel newModel = (ComboBoxModel)event.getNewValue();
                listBox.setModel(newModel);
                comboBox.configureEditor(comboBox.getEditor(), newModel.getSelectedItem());

                ComboBoxModel oldModel = (ComboBoxModel)event.getOldValue();
                oldModel.removeListDataListener(listDataListener);
                newModel.addListDataListener(listDataListener);
            } else if (StringConstants.COMPONENT_ORIENTATION.equals(event.getPropertyName())) {
                listBox.setComponentOrientation((ComponentOrientation)event.getNewValue());
            } else if (StringConstants.IS_TABLE_EDITOR.equals(event.getPropertyName())) {
                isTableEditor = ((Boolean)event.getNewValue()).booleanValue();
View Full Code Here

TOP

Related Classes of javax.swing.ComboBoxModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.