Package java.awt.event

Examples of java.awt.event.ItemListener


      }
      addressComboBox.setSelectedIndex(-1)// nothing selected by default.
     
      // load an item when selected from the list
      addressComboBox.addItemListener(
          new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
              // TODO: typing in the combo and clicking load... causes this event to fire, plus loads from clicking load.
              // TODO: typing in the combo and clicking tab, causes this event to fire.
              logger.fine("addressComboBox state change: " + e);
              if (e.getStateChange() == ItemEvent.SELECTED)
View Full Code Here


        cancelButton.addActionListener(new ActionHandler());
        okButton.addActionListener(new ActionHandler());
        newGroupBox.addActionListener(new ActionHandler());
        buddyAliasBox.addActionListener(new ActionHandler());
        buddyGroups.addItemListener(
            new ItemListener() {
                public void itemStateChanged(ItemEvent e) {
                    String item = (String) e.getItem();
                    if (item.equals(resources.getString("newGroup"))) {
                        newGroupBox.setEnabled(true);
                        newGroupBox.setText("");
View Full Code Here

        for (int i = 0; i < numberOfBoxes; i++) {
            soundButtons[i].addActionListener(listener);
            testButtons[i].addActionListener(playListener);
        }

        methodBox.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                String item = (String) e.getItem();
                if (item == "Command") {
                    commandBox.setEnabled(true);
                    commandBox.grabFocus();
View Full Code Here

                updateComponents();
                setLayoutForSelectedGroup();
                Util.placeDialog(this, m_parent);

                // add listeners
                ItemListener radioButtonItemListener = new ItemListener() {
                        public void itemStateChanged(ItemEvent e) {
                                setLayoutForSelectedGroup();
                                updateComponents();
                        }
                };
                m_explicitRadioButton.addItemListener(radioButtonItemListener);
                m_keywordsRadioButton.addItemListener(radioButtonItemListener);
                m_searchRadioButton.addItemListener(radioButtonItemListener);

                m_cancel.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                                dispose();
                        }
                });

                m_ok.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                                m_okPressed = true;
                                if (m_explicitRadioButton.isSelected()) {
                                        if (m_editedGroup instanceof ExplicitGroup) {
                                                // keep assignments from possible previous ExplicitGroup
                                                m_resultingGroup = m_editedGroup.deepCopy();
                                                m_resultingGroup.setName(m_name.getText().trim());
                                                m_resultingGroup.setHierarchicalContext(getContext());
                                        } else {
                                                m_resultingGroup = new ExplicitGroup(m_name.getText()
                                                                .trim(), getContext());
                                                if (m_editedGroup != null)
                                                        addPreviousEntries();
                                        }
                                } else if (m_keywordsRadioButton.isSelected()) {
                                        // regex is correct, otherwise OK would have been disabled
                                        // therefore I don't catch anything here
                                        m_resultingGroup = new KeywordGroup(
                                                        m_name.getText().trim(), m_kgSearchField.getText()
                                                                        .trim(), m_kgSearchTerm.getText().trim(),
                                                        m_kgCaseSensitive.isSelected(), m_kgRegExp
                                                                        .isSelected(), getContext());
                                        if ((m_editedGroup instanceof ExplicitGroup || m_editedGroup instanceof SearchGroup)
                                                        && m_resultingGroup.supportsAdd()) {
                                                addPreviousEntries();
                                        }
                                } else if (m_searchRadioButton.isSelected()) {
                                        try {
                                                // regex is correct, otherwise OK would have been
                                                // disabled
                                                // therefore I don't catch anything here
                                                m_resultingGroup = new SearchGroup(m_name.getText()
                                                                .trim(), m_sgSearchExpression.getText().trim(),
                                                                m_sgCaseSensitive.isSelected(), m_sgRegExp
                                                                                .isSelected(), getContext());
                                        } catch (Exception e1) {
                                                // should never happen
                                        }
                                }
                                dispose();
                        }
                });

                CaretListener caretListener = new CaretListener() {
                        public void caretUpdate(CaretEvent e) {
                                updateComponents();
                        }
                };

                ItemListener itemListener = new ItemListener() {
                        public void itemStateChanged(ItemEvent e) {
                                updateComponents();
                        }
                };
View Full Code Here

    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    JLabel desc = new JLabel(LangageManager
        .getProperty("statistic.categorydescription.bitrate"));
    final JCheckBox compressBox = new JCheckBox(LangageManager
        .getProperty("statistic.compressbitrates"));
    compressBox.addItemListener(new ItemListener() {
      public void itemStateChanged(ItemEvent arg0) {
        if (compressBox.isSelected()) {
          StringCountRecord[] recs = statistic
              .getRecords(Statistic.MAP_BITRATE);
          String[] compressed = compressBitrates(recs);
View Full Code Here

            public boolean isFocusable() {
                return true;
            }

        };
        button.addItemListener(new ItemListener() {

            public void itemStateChanged(ItemEvent e) {
                if (currentMenu != null) {
                    hideMenuWindow();
                    showMenuWindow(menuAction);
View Full Code Here

        };
        files.addItemListener(this);

        // Create the 'Look In' component
        lookIn = new Choice();
        lookIn.addItemListener(new ItemListener() {

            public void itemStateChanged(ItemEvent e) {
                AWTFileSelector.this.cwd = new File(lookIn.getSelectedItem());
                refresh();               
            }
           
        });
        rebuildLookIn();

        // Create the tool bar
        Panel z = new Panel(new FlowLayout());
        if (showButtons) {
            home = new ImageButton(showButtonImages ? UIUtil.getStockImage(StockIcons.STOCK_HOME, AWTFileSelector.class) : null, showButtonText ? Messages.getString("AWTFileSelector.home") : null, "home"); //$NON-NLS-1$ //$NON-NLS-2$
            home.setHoverButton(true);
            home.addActionListener(this);
            home.setToolTipText(Messages.getString("AWTFileSelector.navigateToYourHomeDirectory")); //$NON-NLS-1$
            z.add(home);
            parent = new ImageButton(showButtonImages ? UIUtil.getStockImage(StockIcons.STOCK_UP_FOLDER, AWTFileSelector.class) : null, showButtonText ? Messages.getString("AWTFileSelector.home") : null, "home"); //$NON-NLS-1$ //$NON-NLS-2$
            parent.setHoverButton(true);
            parent.addActionListener(this);
            parent.setToolTipText(Messages.getString("AWTFileSelector.navigateToParent")); //$NON-NLS-1$
            z.add(parent);
            newFolder = new ImageButton(showButtonImages ? UIUtil.getStockImage(StockIcons.STOCK_NEW_FOLDER, AWTFileSelector.class) : null, showButtonText ? Messages.getString("AWTFileSelector.new") : null, "newFolder"); //$NON-NLS-1$ //$NON-NLS-2$
            newFolder.setHoverButton(true);
            newFolder.addActionListener(this);
            newFolder.setToolTipText(Messages.getString("AWTFileSelector.createFolder")); //$NON-NLS-1$
            z.add(newFolder);
            remove = new ImageButton(showButtonImages ? UIUtil.getStockImage(StockIcons.STOCK_DELETE, AWTFileSelector.class) : null, showButtonText ? Messages.getString("AWTFileSelector.delete") : null, "delete"); //$NON-NLS-1$ //$NON-NLS-2$
            remove.setHoverButton(true);
            remove.addActionListener(this);
            remove.setToolTipText(Messages.getString("AWTFileSelector.removeSelected")); //$NON-NLS-1$
            z.add(remove);
        }
        if (showHiddenFilesSwitch) {
            showHiddenFiles = new Checkbox(Messages.getString("AWTFileSelector.hiddentFiles"));             //$NON-NLS-1$
            showHiddenFiles.addItemListener(new ItemListener() {

                public void itemStateChanged(ItemEvent e) {
                    refresh();
                }
            });
        }

        // Create the top bar
        Panel top = new Panel(new GridBagLayout());
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.fill = GridBagConstraints.HORIZONTAL;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.weightx = 1.0;
        UIUtil.gridBagAdd(top, lookIn, gbc, GridBagConstraints.RELATIVE);
        gbc.weightx = 0.0;
        UIUtil.gridBagAdd(top, z, gbc, GridBagConstraints.REMAINDER);
       
        // Create the path panel
        Panel pathPanel = new Panel(new GridBagLayout());
        GridBagConstraints gbc1 = new GridBagConstraints();
        path = new TextField(""); //$NON-NLS-1$
        path.addActionListener(this);
        gbc1.fill = GridBagConstraints.HORIZONTAL;
        gbc1.anchor = GridBagConstraints.WEST;
        gbc1.weightx = 0.0;
        gbc1.insets = new Insets(2, 2, 2, 2);
        UIUtil.gridBagAdd(pathPanel, new Label(Messages.getString("AWTFileSelector.fileName")), gbc1, showButtons ? 1 : GridBagConstraints.RELATIVE); //$NON-NLS-1$
        gbc1.weightx = 1.0;
        UIUtil.gridBagAdd(pathPanel, path, gbc1, showButtons ? GridBagConstraints.RELATIVE : GridBagConstraints.REMAINDER);
        gbc1.weightx = 0.0;
        if(showButtons) {
            go = new ImageButton(null, Messages.getString("AWTFileSelector.go"), "go"); //$NON-NLS-1$ //$NON-NLS-2$
            go.setHoverButton(true);
            go.addActionListener(this);
            go.setToolTipText(Messages.getString("AWTFileSelector.navigateToSelectedFolder")); //$NON-NLS-1$
            UIUtil.gridBagAdd(pathPanel, go, gbc1, GridBagConstraints.REMAINDER);
        }
        UIUtil.gridBagAdd(pathPanel, new Label(Messages.getString("AWTFileSelector.filesOfType")), gbc1, showButtons ? 1 : GridBagConstraints.RELATIVE); //$NON-NLS-1$
        gbc1.weightx = 1.0;
        filterSelect = new Choice();
        rebuildFilterSelect();
        filterSelect.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                refresh();
            }
        });
        UIUtil.gridBagAdd(pathPanel, filterSelect, gbc1, showButtons ? GridBagConstraints.RELATIVE : GridBagConstraints.REMAINDER);
View Full Code Here

        sign.setDisabledSelectedIcon(signedIcon);
        sign.setDisabledIcon(unsignedIcon);
        sign.setSelectedIcon(signedIcon);
        sign.setIcon(unsignedIcon);

        sign.addItemListener(new ItemListener() {
            public void itemStateChanged(final ItemEvent e) {
                updateSignToolTip();
            }
        });
View Full Code Here

                    }
                });
            }
        });

        myComboScale.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent arg0) {
                run(new Runnable() {
                    public void run() {
                        changeScale();
                    }
                });
            }
        });

        Dimension dim = myComboScale.getPreferredSize();
        dim.setSize(dim.getWidth() + 20, dim.getHeight());
        myComboScale.setMaximumSize(dim);
        myComboScale.setPreferredSize(dim);
        myComboScale.setEditable(true);

        boolean isDate = start != null && end != null;
        ImageIcon icon = new ImageIcon(getClass().getResource(
                "/icons/calendar_16.gif"));

        myStart.lock();
        myFinish.lock();
        if (isDate) {
            /*
            myStartDateButton = new JButton(new GanttCalendar(myStartDate)
                    .toString(), icon);
            myStartDateButton.setHorizontalTextPosition(SwingConstants.RIGHT);
            myStartDateButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    myStartDialogDate = new GanttDialogDate(new JDialog(),
                            new GanttCalendar(myStartDate), false);
                    myStartDialogDate.setVisible(true);
                    if (myStartDialogDate.getValue() == GanttDialogDate.OK) {
                        myStartDate = myStartDialogDate.getDate().getTime();
                        myStartDateButton
                                .setText(new GanttCalendar(myStartDate)
                                        .toString());
                        myExportSettings.setStartDate(myStartDate);
                        updateSourceImage(myChart.getChart(myExportSettings));
                    }
                }
            });

            myEndDateButton = new JButton(new GanttCalendar(myEndDate)
                    .toString(), icon);
            myEndDateButton.setHorizontalTextPosition(SwingConstants.RIGHT);
            myEndDateButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    myEndDialogDate = new GanttDialogDate(new JDialog(),
                            new GanttCalendar(myEndDate), false);
                    myEndDialogDate.setVisible(true);
                    if (myEndDialogDate.getValue() == GanttDialogDate.OK) {
                        myEndDate = myEndDialogDate.getDate().getTime();
                        myEndDateButton.setText(new GanttCalendar(myEndDate)
                                .toString());
                        myExportSettings.setEndDate(myEndDate);
                        updateSourceImage(myChart.getChart(myExportSettings));
                    }
                }
            });
            */
            myWholeProjectButton = new JButton(language.getText("wholeProject"));
            myWholeProjectButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    myStart.setValue(myChart.getStartDate());
                    myFinish.setValue(myChart.getEndDate());
                    /*
                    myStartDate = myChart.getStartDate();
                    myEndDate = myChart.getEndDate();
                    myExportSettings.setStartDate(myStartDate);
                    myExportSettings.setEndDate(myEndDate);

                    myEndDateButton.setText(new GanttCalendar(myExportSettings
                            .getEndDate()).toString());
                    myStartDateButton.setText(new GanttCalendar(
                            myExportSettings.getStartDate()).toString());
                    myEndDialogDate = new GanttDialogDate(new JDialog(),
                            new GanttCalendar(myEndDate), false);
                    myStartDialogDate = new GanttDialogDate(new JDialog(),
                            new GanttCalendar(myStartDate), false);
                    updateSourceImage(myChart.getChart(myExportSettings));
                    */
                }
            });
        }
        Vector vMedia = new Vector();
        ;
        // try {
        // vMedia = getAllMediaSizeNameAvailable();
        vMedia.add(MediaSizeName.ISO_A0);
        vMedia.add(MediaSizeName.ISO_A1);
        vMedia.add(MediaSizeName.ISO_A2);
        vMedia.add(MediaSizeName.ISO_A3);
        vMedia.add(MediaSizeName.ISO_A4);
        vMedia.add(MediaSizeName.ISO_A5);
        vMedia.add(MediaSizeName.ISO_A6);
        // } catch (ClassNotFoundException e1) {
        // // TODO Auto-generated catch block
        // e1.printStackTrace();
        // }

        if (vMedia != null) {
            myComboMediaSize = new JComboBox(vMedia);
            dim = myComboMediaSize.getPreferredSize();
            dim.setSize(dim.getWidth() + 20, dim.getHeight());
            myComboMediaSize.setMaximumSize(dim);
            myComboMediaSize.setPreferredSize(dim);
            myComboMediaSize.addItemListener(new ItemListener() {
                public void itemStateChanged(ItemEvent arg0) {
                    run(new Runnable() {
                        public void run() {
                            Object selectedItem = myComboMediaSize
                                    .getSelectedItem();
View Full Code Here

      });
    this.backFaceShownLabel = new JLabel(preferences.getLocalizedString(
        ImportedFurnitureWizardStepsPanel.class, "backFaceShownLabel.text"));
    this.backFaceShownCheckBox = new JCheckBox(SwingTools.getLocalizedLabelText(preferences,
        ImportedFurnitureWizardStepsPanel.class, "backFaceShownCheckBox.text"));
    this.backFaceShownCheckBox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent ev) {
          controller.setBackFaceShown(backFaceShownCheckBox.isSelected());
        }
      });
    controller.addPropertyChangeListener(ImportedFurnitureWizardController.Property.BACK_FACE_SHOWN,
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
            // If back face shown changes update back face shown check box
            backFaceShownCheckBox.setSelected(controller.isBackFaceShown());
          }
        });
    this.rotationPreviewComponent = new RotationPreviewComponent(preferences, controller);
   
    // Attributes panel components
    this.attributesLabel = new JLabel(preferences.getLocalizedString(
        ImportedFurnitureWizardStepsPanel.class, "attributesLabel.text"));
    this.nameLabel = new JLabel(SwingTools.getLocalizedLabelText(preferences,
        ImportedFurnitureWizardStepsPanel.class, "nameLabel.text"));
    this.nameTextField = new JTextField(10);
    if (!OperatingSystem.isMacOSXLeopardOrSuperior()) {
      SwingTools.addAutoSelectionOnFocusGain(this.nameTextField);
    }
    final Color defaultNameTextFieldColor = this.nameTextField.getForeground();
    DocumentListener nameListener = new DocumentListener() {
        public void changedUpdate(DocumentEvent ev) {
          nameTextField.getDocument().removeDocumentListener(this);
          controller.setName(nameTextField.getText().trim());
          nameTextField.getDocument().addDocumentListener(this);
        }
 
        public void insertUpdate(DocumentEvent ev) {
          changedUpdate(ev);
        }
 
        public void removeUpdate(DocumentEvent ev) {
          changedUpdate(ev);
        }
      };
    this.nameTextField.getDocument().addDocumentListener(nameListener);
    controller.addPropertyChangeListener(ImportedFurnitureWizardController.Property.NAME,
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
            // If name changes update name text field
            if (!nameTextField.getText().trim().equals(controller.getName())) {
              nameTextField.setText(controller.getName());
            }
            updateNameTextFieldForeground(defaultNameTextFieldColor);
          }
        });

    this.addToCatalogCheckBox = new JCheckBox(SwingTools.getLocalizedLabelText(preferences,
        ImportedFurnitureWizardStepsPanel.class, "addToCatalogCheckBox.text"));
    // Propose the add to catalog option only for home furniture import
    this.addToCatalogCheckBox.setVisible(importHomePiece);
    this.addToCatalogCheckBox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent ev) {
          if (addToCatalogCheckBox.isSelected()) {
            categoryComboBox.setEnabled(true);
            controller.setCategory((FurnitureCategory)categoryComboBox.getSelectedItem());
          } else {
            categoryComboBox.setEnabled(false);
            controller.setCategory(null);
          }
        }
      });
    this.categoryLabel = new JLabel(SwingTools.getLocalizedLabelText(preferences,
        ImportedFurnitureWizardStepsPanel.class, "categoryLabel.text"));
    this.categoryComboBox = new JComboBox(preferences.getFurnitureCatalog().getCategories().toArray());
    // The piece category isn't enabled by default for home furniture import
    this.categoryComboBox.setEnabled(!importHomePiece);
    this.categoryComboBox.setEditable(true);
    final ComboBoxEditor defaultEditor = this.categoryComboBox.getEditor();
    // Change editor to edit category name
    this.categoryComboBox.setEditor(new ComboBoxEditor() {
        public Object getItem() {
          String name = (String)defaultEditor.getItem();
          name = name.trim();
          // If category is empty, replace it by the last selected item
          if (name.length() == 0) {
            setItem(categoryComboBox.getSelectedItem());
          }
          FurnitureCategory category = new FurnitureCategory(name);
          // Search an existing category
          List<FurnitureCategory> categories = preferences.getFurnitureCatalog().getCategories();
          int categoryIndex = Collections.binarySearch(categories, category);
          if (categoryIndex >= 0) {
            return categories.get(categoryIndex);
          }
          // If no existing category was found, return a new one         
          return category;
        }
     
        public void setItem(Object value) {
          if (value != null) {
            FurnitureCategory category = (FurnitureCategory)value;
            defaultEditor.setItem(category.getName());
          }
        }

        public void addActionListener(ActionListener l) {
          defaultEditor.addActionListener(l);
        }

        public Component getEditorComponent() {
          return defaultEditor.getEditorComponent();
        }

        public void removeActionListener(ActionListener l) {
          defaultEditor.removeActionListener(l);
        }

        public void selectAll() {
          defaultEditor.selectAll();
        }
      });
    this.categoryComboBox.setRenderer(new DefaultListCellRenderer() {
        public Component getListCellRendererComponent(JList list, Object value, int index,
                                                      boolean isSelected, boolean cellHasFocus) {
          FurnitureCategory category = (FurnitureCategory)value;
          return super.getListCellRendererComponent(list, category.getName(), index, isSelected, cellHasFocus);
        }
      });
    this.categoryComboBox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent ev) {
          controller.setCategory((FurnitureCategory)ev.getItem());
        }
      });
    controller.addPropertyChangeListener(ImportedFurnitureWizardController.Property.CATEGORY,
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
            // If category changes update category combo box
            FurnitureCategory category = controller.getCategory();
            if (category != null) {
              categoryComboBox.setSelectedItem(category);
            }
            updateNameTextFieldForeground(defaultNameTextFieldColor);
          }
        });
    if (this.categoryComboBox.getItemCount() > 0) {
      this.categoryComboBox.setSelectedIndex(0);
    }

    this.widthLabel = new JLabel(SwingTools.getLocalizedLabelText(preferences,
        ImportedFurnitureWizardStepsPanel.class, "widthLabel.text", unitName));
    final float minimumLength = preferences.getLengthUnit().getMinimumLength();
    final NullableSpinner.NullableSpinnerLengthModel widthSpinnerModel =
        new NullableSpinner.NullableSpinnerLengthModel(preferences, Math.min(controller.getWidth(), minimumLength), 100000f);
    this.widthSpinner = new NullableSpinner(widthSpinnerModel);
    widthSpinnerModel.addChangeListener(new ChangeListener () {
        public void stateChanged(ChangeEvent ev) {
          widthSpinnerModel.removeChangeListener(this);
          // If width spinner value changes update controller
          controller.setWidth(widthSpinnerModel.getLength());
          widthSpinnerModel.addChangeListener(this);
        }
      });
    controller.addPropertyChangeListener(ImportedFurnitureWizardController.Property.WIDTH,
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
            // If width changes update width spinner
            widthSpinnerModel.setLength(controller.getWidth());
            widthSpinnerModel.setMinimum(Math.min(controller.getWidth(), minimumLength));
          }
        });
   
    this.depthLabel = new JLabel(SwingTools.getLocalizedLabelText(preferences,
        ImportedFurnitureWizardStepsPanel.class, "depthLabel.text", unitName));
    final NullableSpinner.NullableSpinnerLengthModel depthSpinnerModel =
        new NullableSpinner.NullableSpinnerLengthModel(preferences, Math.min(controller.getDepth(), minimumLength), 100000f);
    this.depthSpinner = new NullableSpinner(depthSpinnerModel);
    depthSpinnerModel.addChangeListener(new ChangeListener () {
        public void stateChanged(ChangeEvent ev) {
          depthSpinnerModel.removeChangeListener(this);
          // If depth spinner value changes update controller
          controller.setDepth(depthSpinnerModel.getLength());
          depthSpinnerModel.addChangeListener(this);
        }
      });
    controller.addPropertyChangeListener(ImportedFurnitureWizardController.Property.DEPTH,
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
            // If depth changes update depth spinner
            depthSpinnerModel.setLength(controller.getDepth());
            depthSpinnerModel.setMinimum(Math.min(controller.getDepth(), minimumLength));
          }
        });
   
    this.heightLabel = new JLabel(SwingTools.getLocalizedLabelText(preferences,
            ImportedFurnitureWizardStepsPanel.class, "heightLabel.text", unitName));
    final NullableSpinner.NullableSpinnerLengthModel heightSpinnerModel =
        new NullableSpinner.NullableSpinnerLengthModel(preferences, Math.min(controller.getHeight(), minimumLength), 100000f);
    this.heightSpinner = new NullableSpinner(heightSpinnerModel);
    heightSpinnerModel.addChangeListener(new ChangeListener () {
        public void stateChanged(ChangeEvent ev) {
          heightSpinnerModel.removeChangeListener(this);
          // If width spinner value changes update controller
          controller.setHeight(heightSpinnerModel.getLength());
          heightSpinnerModel.addChangeListener(this);
        }
      });
    controller.addPropertyChangeListener(ImportedFurnitureWizardController.Property.HEIGHT,
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
            // If height changes update height spinner
            heightSpinnerModel.setLength(controller.getHeight());
            heightSpinnerModel.setMinimum(Math.min(controller.getHeight(), minimumLength));
          }
        });
    this.keepProportionsCheckBox = new JCheckBox(SwingTools.getLocalizedLabelText(preferences,
        ImportedFurnitureWizardStepsPanel.class, "keepProportionsCheckBox.text"));
    this.keepProportionsCheckBox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent ev) {
          controller.setProportional(keepProportionsCheckBox.isSelected());
        }
      });
    controller.addPropertyChangeListener(ImportedFurnitureWizardController.Property.PROPORTIONAL,
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
            // If proportional property changes update keep proportions check box
            keepProportionsCheckBox.setSelected(controller.isProportional());
          }
        });
   
    this.elevationLabel = new JLabel(SwingTools.getLocalizedLabelText(preferences,
        ImportedFurnitureWizardStepsPanel.class, "elevationLabel.text", unitName));
    final NullableSpinner.NullableSpinnerLengthModel elevationSpinnerModel =
        new NullableSpinner.NullableSpinnerLengthModel(preferences, 0f, 2500f);
    this.elevationSpinner = new NullableSpinner(elevationSpinnerModel);
    elevationSpinnerModel.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent ev) {
          widthSpinnerModel.removeChangeListener(this);
          controller.setElevation(elevationSpinnerModel.getLength());
          widthSpinnerModel.addChangeListener(this);
        }
      });
    controller.addPropertyChangeListener(ImportedFurnitureWizardController.Property.ELEVATION,
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
            // If elevation changes update elevation spinner
            elevationSpinnerModel.setLength(controller.getElevation());
          }
        });
   
    this.movableCheckBox = new JCheckBox(SwingTools.getLocalizedLabelText(preferences,
        ImportedFurnitureWizardStepsPanel.class, "movableCheckBox.text"));
    this.movableCheckBox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent ev) {
          controller.setMovable(movableCheckBox.isSelected());
        }
      });
    controller.addPropertyChangeListener(ImportedFurnitureWizardController.Property.MOVABLE,
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
            // If movable changes update movable check box
            movableCheckBox.setSelected(controller.isMovable());
          }
        });

    this.doorOrWindowCheckBox = new JCheckBox(SwingTools.getLocalizedLabelText(preferences,
        ImportedFurnitureWizardStepsPanel.class, "doorOrWindowCheckBox.text"));
    this.doorOrWindowCheckBox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent ev) {
          controller.setDoorOrWindow(doorOrWindowCheckBox.isSelected());
        }
      });
    controller.addPropertyChangeListener(ImportedFurnitureWizardController.Property.DOOR_OR_WINDOW,
View Full Code Here

TOP

Related Classes of java.awt.event.ItemListener

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.