Package javax.swing

Examples of javax.swing.ComboBoxModel


   * @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

      }
    }  
   }
  
   private void setModel(JComboBox box, ArtifactAction... actions) {
     ComboBoxModel oldModel = box.getModel();
     box.setModel(getComboBoxModel(actions));
     if (oldModel.getSize() != actions.length) {
       box.firePropertyChange("itemCount", oldModel.getSize(), actions.length);
     }
   }
View Full Code Here

       box.firePropertyChange("itemCount", oldModel.getSize(), actions.length);
     }
   }
  
   private ComboBoxModel getComboBoxModel(ArtifactAction... actions) {
     ComboBoxModel result = new DefaultComboBoxModel(actions);
     result.setSelectedItem(actions[0]);
     return result;
   }
View Full Code Here

        result.setComponentOrientation(componentOrientation);
        return result;
    }

    private JComboBox createEnumerationComponent(EnumerationOption option) {
        ComboBoxModel model = new EnumerationOptionComboBoxModel(option);
        JComboBox result = new JComboBox(model);
        return result;
    }
View Full Code Here

        comboBoxList.add(column);
        if (column == previousItem) {
          selectedIndex = comboBoxList.size() - 1;
        }
      }
      final ComboBoxModel model = new ListComboBoxModel<Column>(comboBoxList);
      setModel(model);
      setSelectedIndex(selectedIndex);
    }
  }
View Full Code Here

            }
          }
        }
      }

      final ComboBoxModel model = new ListComboBoxModel<Object>(comboBoxList);
      setModel(model);
      if (retainSelection) {
        setSelectedIndex(selectedIndex);
      }
    }
View Full Code Here

    return b;
  }
 
  public JComboBox getComboBox()
  {
    final ComboBoxModel    model      = getComboBoxModel();
    final ComboBoxModel    emptyCBM    = new DefaultComboBoxModel();
    final MultiStateButton  button      = b;
    final JComboBox      ggBlend      = new JComboBox(); // ( pcbm );
    final ListCellRenderer  blendRenderer  = getComboBoxRenderer();
   
    ggBlend.setEditable( true );
View Full Code Here

    if(value==null)
      return "null";
    String className = imports.addImport("javax.swing.DefaultComboBoxModel");
    StringBuilder builder=new StringBuilder();
    builder.append("new "+className+"(new Object[]{\n");
    ComboBoxModel model = (ComboBoxModel)value;
    for(int i=0;i<model.getSize();i++){
      if(i!=0)
        builder.append(",");
      Object obj=model.getElementAt(i);
      if(obj==null){
        builder.append("null");
      }else{
        TypeAdapter adapter=ExtensionRegistry.getTypeAdapter(obj.getClass());
        if(adapter!=null&&adapter.getCodegen()!=null){
View Full Code Here

public class ComboBoxModelCloner implements ICloner {

 
  public Object clone(Object object) {
    ComboBoxModel cbm = (ComboBoxModel) object;
    int count = cbm.getSize();
    Object[]elements = new Object[count];
    for(int i=0;i<count;i++){
      Object element = cbm.getElementAt(i);
      if(element == null){
        elements[i] = null;
      }else{
        Object current = element;
        TypeAdapter adapter = ExtensionRegistry.getTypeAdapter(element.getClass());
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.