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

The following examples show how to use javax.swing.JPanel#addPropertyChangeListener() . 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
Source File: CollocationCrsForm.java    From snap-desktop with GNU General Public License v3.0 6 votes vote down vote up
@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
Source File: CustomizerWSServiceHost.java    From netbeans with 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(WsCompileEditorSupport.PROP_FEATURES_CHANGED, this);
}
 
Example 3
Source File: CustomizerWSClientHost.java    From netbeans with 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
Source File: CustomizerWSServiceHost.java    From netbeans with Apache License 2.0 5 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(WsCompileEditorSupport.PROP_FEATURES_CHANGED, this);
    }
 
Example 5
Source File: CustomizerWSClientHost.java    From netbeans with 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
Source File: PredefinedCrsForm.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
@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
Source File: TimeSeriesAssistantPage_ReprojectingSources.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
@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 File: CustomizerWSClientHost.java    From netbeans with 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 File: SeaGlassPanelUI.java    From seaglass with 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);
}