Java Code Examples for javax.swing.JPanel#addPropertyChangeListener()

The following examples show how to use javax.swing.JPanel#addPropertyChangeListener() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
protected JComponent createCrsComponent() {
    collocateProductSelector = new SourceProductSelector(getAppContext(), "Product:");
    collocateProductSelector.setProductFilter(new CollocateProductFilter());
    collocateProductSelector.addSelectionChangeListener(new AbstractSelectionChangeListener() {
        @Override
        public void selectionChanged(SelectionChangeEvent event) {
            fireCrsChanged();
        }
    });

    final JPanel panel = new JPanel(new BorderLayout(2, 2));
    panel.add(collocateProductSelector.getProductNameComboBox(), BorderLayout.CENTER);
    panel.add(collocateProductSelector.getProductFileChooserButton(), BorderLayout.EAST);
    panel.addPropertyChangeListener("enabled", new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            collocateProductSelector.getProductNameComboBox().setEnabled(panel.isEnabled());
            collocateProductSelector.getProductFileChooserButton().setEnabled(panel.isEnabled());
            final boolean collocate = getRadioButton().isSelected();
            getCrsUI().firePropertyChange("collocate", !collocate, collocate);
        }
    });
    return panel;
}
 
Example 2
@Override
public void addNotify() {
    super.addNotify();

    JPanel component = wsCompileEditor.getComponent();

    removeAll(); // !PW is this necessary?
    add(component);

    component.addPropertyChangeListener(WsCompileEditorSupport.PROP_FEATURES_CHANGED, this);
}
 
Example 3
Source Project: netbeans   File: CustomizerWSClientHost.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void addNotify() {
    super.addNotify();

    JPanel component = wsCompileEditor.getComponent();

    removeAll(); // !PW is this necessary?
    add(component);

    component.addPropertyChangeListener(WsCompileClientEditorSupport.PROP_FEATURES_CHANGED, this);
    component.addPropertyChangeListener(WsCompileClientEditorSupport.PROP_OPTIONS_CHANGED, this);
}
 
Example 4
public void addNotify() {
        super.addNotify();
        
//        System.out.println("WSClientCustomizer: addNotify (" + this.getComponentCount() + " subcomponents)");
        JPanel component = wsCompileEditor.getComponent();

        removeAll(); // !PW is this necessary?
        add(component);
        
        component.addPropertyChangeListener(WsCompileEditorSupport.PROP_FEATURES_CHANGED, this);
    }
 
Example 5
Source Project: netbeans   File: CustomizerWSClientHost.java    License: Apache License 2.0 5 votes vote down vote up
@Override
    public void addNotify() {
        super.addNotify();
        
//        System.out.println("WSClientCustomizer: addNotify (" + this.getComponentCount() + " subcomponents)");
        JPanel component = wsCompileEditor.getComponent();

        removeAll(); // !PW is this necessary?
        add(component);
        
        component.addPropertyChangeListener(WsCompileClientEditorSupport.PROP_FEATURES_CHANGED, this);
        component.addPropertyChangeListener(WsCompileClientEditorSupport.PROP_OPTIONS_CHANGED, this);
    }
 
Example 6
@Override
protected JComponent createCrsComponent() {
    final TableLayout tableLayout = new TableLayout(2);
    final JPanel panel = new JPanel(tableLayout);
    tableLayout.setTableAnchor(TableLayout.Anchor.WEST);
    tableLayout.setTableFill(TableLayout.Fill.HORIZONTAL);
    tableLayout.setColumnWeightX(0, 1.0);
    tableLayout.setColumnWeightX(1, 0.0);

    final JTextField crsCodeField = new JTextField();
    crsCodeField.setEditable(false);
    final JButton crsButton = new JButton("Select...");
    final PredefinedCrsPanel predefinedCrsForm = new PredefinedCrsPanel(
            new CrsInfoListModel(CrsInfo.generateCRSList()));
    crsButton.addActionListener(e -> {
        final ModalDialog dialog = new ModalDialog(null,
                                                   "Select Coordinate Reference System",
                                                   predefinedCrsForm,
                                                   ModalDialog.ID_OK_CANCEL, null);
        if (dialog.show() == ModalDialog.ID_OK) {
            selectedCrsInfo = predefinedCrsForm.getSelectedCrsInfo();
            if (selectedCrsInfo != null) {
                crsCodeField.setText(selectedCrsInfo.toString());
                fireCrsChanged();
            }
        }
    });
    panel.add(crsCodeField);
    panel.add(crsButton);
    panel.addPropertyChangeListener("enabled", evt -> {
        crsCodeField.setEnabled((Boolean) evt.getNewValue());
        crsButton.setEnabled((Boolean) evt.getNewValue());
    });
    return panel;
}
 
Example 7
@Override
protected JComponent createCrsComponent() {
    collocateProductSelector = new SourceProductSelector(SnapApp.getDefault().getAppContext(), "Product:");
    List<Product> products = new ArrayList<>();
    for (ProductLocation productLocation : assistantModel.getProductLocationsModel().getProductLocations()) {
        for (Product product : productLocation.getProducts(ProgressMonitor.NULL).values()) {
            products.add(product);
        }
    }
    collocateProductSelector.setProductFilter(new CollocateProductFilter(products));
    collocateProductSelector.addSelectionChangeListener(new AbstractSelectionChangeListener() {
        @Override
        public void selectionChanged(SelectionChangeEvent event) {
            fireCrsChanged();
        }
    });

    final JPanel panel = new JPanel(new BorderLayout(2, 2));
    panel.add(collocateProductSelector.getProductNameComboBox(), BorderLayout.CENTER);
    panel.add(collocateProductSelector.getProductFileChooserButton(), BorderLayout.EAST);
    panel.addPropertyChangeListener("enabled", evt -> {
        collocateProductSelector.getProductNameComboBox().setEnabled(panel.isEnabled());
        collocateProductSelector.getProductFileChooserButton().setEnabled(panel.isEnabled());
        final boolean collocate = getRadioButton().isSelected();
        getCrsUI().firePropertyChange("collocate", !collocate, collocate);
    });
    return panel;
}
 
Example 8
Source Project: netbeans   File: CustomizerWSClientHost.java    License: Apache License 2.0 3 votes vote down vote up
public void addNotify() {
        super.addNotify();
        
//        System.out.println("WSClientCustomizer: addNotify (" + this.getComponentCount() + " subcomponents)");
        JPanel component = wsCompileEditor.getComponent();

        removeAll(); // !PW is this necessary?
        add(component);
        
        component.addPropertyChangeListener(WsCompileClientEditorSupport.PROP_FEATURES_CHANGED, this);
        component.addPropertyChangeListener(WsCompileClientEditorSupport.PROP_OPTIONS_CHANGED, this);
        
    }
 
Example 9
Source Project: seaglass   File: SeaGlassPanelUI.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Install the listeners.
 *
 * @param p the panel.
 */
protected void installListeners(JPanel p) {
    p.addPropertyChangeListener(this);
}