Package javax.swing

Examples of javax.swing.ComboBoxModel


        alignment = JTextField.LEFT;
        break;
    }

    if (lookup) {
      ComboBoxModel comboData =
          new DefaultComboBoxModel(field.getLookupValues());
      ListCellRenderer comboRenderer =
          cellRenderers.createListCellRenderer(field);
      JComboBox comboBox = new JComboBox(comboData);
      comboBox.setRenderer(comboRenderer);
      editor = comboBox;
    } else if (format != null) {
      if (format instanceof MapFormat) {
        MapFormat mapFormat = (MapFormat)format;
        ComboBoxModel comboData =
          new DefaultComboBoxModel((mapFormat).getValues());
        ListCellRenderer comboRenderer =
          cellRenderers.createFormatListCellRenderer(
          mapFormat, mapFormat.getNullFormat(), null, -1);
        JComboBox comboBox = new JComboBox(comboData);
View Full Code Here


 
  private void initGUI() {
    try {
      this.setPreferredSize(new java.awt.Dimension(180, 600));
      {
        ComboBoxModel jComboBox1Model =
          new DefaultComboBoxModel(
              Acting.values());
        jComboBox1 = new JComboBox();
        this.add(getJSeparator2());
        this.add(getJLabel12());
        this.add(getJLabel1());
        this.add(jComboBox1);
        this.add(getJLabel2());
        jComboBox1.setModel(jComboBox1Model);
        jComboBox1.setPreferredSize(new java.awt.Dimension(80, 21));
        jComboBox1.addActionListener(listener);
      }
      {
        ComboBoxModel jComboBox2Model =
          new DefaultComboBoxModel(
              AttackResult.values());
        jComboBox2 = new JComboBox();
        this.add(jComboBox2);
        this.add(getJLabel3());
        jComboBox2.setModel(jComboBox2Model);
        jComboBox2.setPreferredSize(new java.awt.Dimension(80, 21));
        jComboBox2.addActionListener(listener);
      }
      {
        ComboBoxModel jComboBox3Model =
          new DefaultComboBoxModel(
              AttackVector.values());
        jComboBox3 = new JComboBox();
        this.add(jComboBox3);
        this.add(getJLabel4());
        jComboBox3.setModel(jComboBox3Model);
        jComboBox3.setPreferredSize(new java.awt.Dimension(80, 21));
        jComboBox3.addActionListener(listener);
      }
      {
        ComboBoxModel jComboBox4Model =
          new DefaultComboBoxModel(
              Direction.values());
        jComboBox4 = new JComboBox();
        this.add(jComboBox4);
        this.add(getJLabel5());
        jComboBox4.setModel(jComboBox4Model);
        jComboBox4.setPreferredSize(new java.awt.Dimension(80, 21));
        jComboBox4.addActionListener(listener);
      }
      {
        ComboBoxModel jComboBox5Model =
          new DefaultComboBoxModel(
              Enemy.values());
        jComboBox5 = new JComboBox();
        this.add(jComboBox5);
        this.add(getJLabel6());
        jComboBox5.setModel(jComboBox5Model);
        jComboBox5.setPreferredSize(new java.awt.Dimension(80, 21));
        jComboBox5.addActionListener(listener);
      }
      {
        ComboBoxModel jComboBox6Model =
          new DefaultComboBoxModel(
              Hurt.values());
        jComboBox6 = new JComboBox();
        this.add(jComboBox6);
        this.add(getJLabel7());
        jComboBox6.setModel(jComboBox6Model);
        jComboBox6.setPreferredSize(new java.awt.Dimension(80, 21));
        jComboBox6.addActionListener(listener);
      }
      {
        ComboBoxModel jComboBox7Model =
          new DefaultComboBoxModel(
              HurtVector.values());
        jComboBox7 = new JComboBox();
        this.add(jComboBox7);
        this.add(getJLabel8());
        jComboBox7.setModel(jComboBox7Model);
        jComboBox7.setPreferredSize(new java.awt.Dimension(80, 21));
        jComboBox7.addActionListener(listener);
      }
      {
        ComboBoxModel jComboBox8Model =
          new DefaultComboBoxModel(
              Morale.values());
        jComboBox8 = new JComboBox();
        this.add(jComboBox8);
        this.add(getJLabel9());
        jComboBox8.setModel(jComboBox8Model);
        jComboBox8.setPreferredSize(new java.awt.Dimension(80, 21));
        jComboBox8.addActionListener(listener);
      }
      {
        ComboBoxModel jComboBox9Model =
          new DefaultComboBoxModel(
              Speed.values());
        jComboBox9 = new JComboBox();
        this.add(jComboBox9);
        this.add(getJLabel10());
        jComboBox9.setModel(jComboBox9Model);
        jComboBox9.setPreferredSize(new java.awt.Dimension(80, 21));
        jComboBox9.addActionListener(listener);
      }
      {
        ComboBoxModel jComboBox10Model =
          new DefaultComboBoxModel(
              Target.values());
        jComboBox10 = new JComboBox();
        this.add(jComboBox10);
        this.add(getJLabel11());
        jComboBox10.setModel(jComboBox10Model);
        jComboBox10.setPreferredSize(new java.awt.Dimension(80, 21));
        jComboBox10.addActionListener(listener);
      }
      {
        ComboBoxModel jComboBox11Model =
          new DefaultComboBoxModel(
              Weapon.values());
        jComboBox11 = new JComboBox();
        this.add(jComboBox11);
        this.add(getJSeparator1());
View Full Code Here

 
  private void initGUI() {
    try {
      this.setPreferredSize(new java.awt.Dimension(180, 220));
      {
        ComboBoxModel jComboBox1Model =
          new DefaultComboBoxModel(
              Acting.values());
        jComboBox1 = new JComboBox();
        this.add(getJSeparator2());
        this.add(getJLabel12());
        this.add(getJLabel1());
        this.add(jComboBox1);
        jComboBox1.setModel(jComboBox1Model);
        jComboBox1.setPreferredSize(new java.awt.Dimension(80, 21));
        jComboBox1.addActionListener(listener);
      }
      {
        ComboBoxModel jComboBox2Model =
          new DefaultComboBoxModel(
              AttackType.values());
        jComboBox2 = new JComboBox();
        this.add(getJLabel2());
        this.add(jComboBox2);
        jComboBox2.setModel(jComboBox2Model);
        jComboBox2.setPreferredSize(new java.awt.Dimension(80, 21));
        jComboBox2.addActionListener(listener);
      }
      {
        ComboBoxModel jComboBox3Model =
          new DefaultComboBoxModel(
              Movement.values());
        jComboBox3 = new JComboBox();
        this.add(getJLabel3());
        this.add(jComboBox3);
        jComboBox3.setModel(jComboBox3Model);
        jComboBox3.setPreferredSize(new java.awt.Dimension(80, 21));
        jComboBox3.addActionListener(listener);
      }
      {
        ComboBoxModel jComboBox4Model =
          new DefaultComboBoxModel(
              Target.values());
        jComboBox4 = new JComboBox();
        this.add(getJLabel4());
        this.add(jComboBox4);
View Full Code Here

              jButton1.setEnabled(false);
          }});
      }
      {
       
        ComboBoxModel raceBoxModel =
          new DefaultComboBoxModel(Race.getRaces());
        raceBox = new JComboBox();
        this.add(raceBox);
        raceBox.setModel(raceBoxModel);
        raceBox.setBounds(77, 40, 128, 21);
       
        raceBox.addItemListener(new ItemListener(){

          @Override
          public void itemStateChanged(ItemEvent e) {
            Race r = Race.valueOf(e.getItem().toString());
            switch(r.getStartClass()){
            case 1: classBox.setModel(new DefaultComboBoxModel(
                new String[] { FIGHTER }));break;
            case 3: classBox.setModel(new DefaultComboBoxModel(
                  new String[] { FIGHTER, WIZARD }));break;
            case 12: classBox.setModel(new DefaultComboBoxModel(
                new String[] { SOLDIER }));break;
            default:classBox.setModel(new DefaultComboBoxModel(
              new String[] { FIGHTER, WIZARD }));
            }
          }
         
        });
      }
      {
        ComboBoxModel genderBoxModel =
          new DefaultComboBoxModel(
              new String[] { "Male", "Female" });
        genderBox = new JComboBox();
        this.add(genderBox);
        genderBox.setModel(genderBoxModel);
//        genderBox.setBounds(77, 131, 128, 20);
        genderBox.setBounds(77, 73, 126, 21);
      }
      {
        ComboBoxModel classBoxModel =
          new DefaultComboBoxModel(
              new String[] { "" });
        classBox = new JComboBox();
        this.add(classBox);
        classBox.setModel(classBoxModel);
View Full Code Here

          super(TextUtils.getText("filter_dialog"), false);
        }

    protected DefaultComboBoxModel createModel() {
      DefaultComboBoxModel model = new DefaultComboBoxModel();
      ComboBoxModel externalConditionsModel = filterController.getFilterConditions();
      for (int i = 2; i < externalConditionsModel.getSize(); i++) {
        final Object element = externalConditionsModel.getElementAt(i);
        model.addElement(element);
      }
      Object selectedItem = externalConditionsModel.getSelectedItem();
      if(model.getIndexOf(selectedItem) != -1){
        model.setSelectedItem(selectedItem);
      }
      else{
        model.setSelectedItem(null);
View Full Code Here

    public void itemStateChanged(final ItemEvent e) {
      if (e.getStateChange() == ItemEvent.SELECTED) {
        final Object selectedProperty = filteredPropertiesComponent.getSelectedItem();
        final IElementaryConditionController conditionController = filterController.getConditionFactory()
        .getConditionController(selectedProperty);
        final ComboBoxModel simpleConditionComboBoxModel = conditionController
        .getConditionsForProperty(selectedProperty);
        elementaryConditions.setModel(simpleConditionComboBoxModel);
        elementaryConditions.setEnabled(simpleConditionComboBoxModel.getSize() > 0);
        setValuesEditor();
        return;
      }
    }
View Full Code Here

  public ComboBoxModel getValuesForProperty(final Object property, NamedObject simpleCond) {
    final Object[] items = new Object[10];
    for (int i = 1; i < 10; ++i) {
      items[i - 1] = STORE.getMindIcon("full-" + Integer.toString(i));
    }
    final ComboBoxModel box = new DefaultComboBoxModel(items);
    return box;
  }
View Full Code Here

  }

  private void attributesChanged() {
    final MapModel map = Controller.getCurrentController().getMap();
    final AttributeRegistry attributes = AttributeRegistry.getRegistry(map);
    final ComboBoxModel names = attributes.getComboBoxModel();
    attributeNames.setModel(new ClonedComboBoxModel(names));
    attributeNames.setEditable(!attributes.isRestricted());
    replacingAttributeNames.setModel(new ClonedComboBoxModel(names));
    replacingAttributeNames.setEditable(!attributes.isRestricted());
    if (attributes.size() > 0) {
      final Object first = names.getElementAt(0);
      attributeNames.setSelectedItem(first);
      replacingAttributeNames.setSelectedItem(first);
      selectedAttributeChanged(attributeNames.getSelectedItem(), attributeValues);
      selectedAttributeChanged(replacingAttributeNames.getSelectedItem(), replacingAttributeValues);
    }
View Full Code Here

  private void selectedAttributeChanged(final Object selectedAttributeName, final JComboBox values) {
    final MapModel map = Controller.getCurrentController().getMap();
    final AttributeRegistry attributes = AttributeRegistry.getRegistry(map);
    try {
      final AttributeRegistryElement element = attributes.getElement(selectedAttributeName.toString());
      final ComboBoxModel selectedValues = element.getValues();
      values.setModel(new ClonedComboBoxModel(selectedValues));
      try {
        final Object firstValue = selectedValues.getElementAt(0);
        values.setSelectedItem(firstValue);
      }
      catch (final ArrayIndexOutOfBoundsException ex) {
      }
      values.setEditable(!element.isRestricted());
View Full Code Here

    //Attribute name combo-box
    gridBagConstraints.insets = new Insets(2, 10, 20, 10);
    attributeNames = new JComboBox();
    final MapModel map = Controller.getCurrentController().getMap();
    final AttributeRegistry attributes = AttributeRegistry.getRegistry(map);
    final ComboBoxModel names = attributes.getComboBoxModel();
    attributeNames.setModel(new ClonedComboBoxModel(names));
    attributeNames.setEditable(true);
    attributeNames.setMaximumSize(comboBoxMaximumSize);
    attributeNames.setPreferredSize(comboBoxMaximumSize);
    attributeNames.addItemListener(new ItemListener() {
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.