protected static void setValue(JCheckBox checkBox, boolean isSelected){ ActionListener[] listeners = checkBox.getActionListeners(); ActionListener listener = null; if(listeners != null && listeners.length >0){ listener = listeners[0]; checkBox.removeActionListener(listener); } checkBox.setSelected(isSelected); if(listener != null) checkBox.addActionListener(listener); }
protected static void setValue(JCheckBox checkBox, boolean isSelected){ ActionListener[] listeners = checkBox.getActionListeners(); ActionListener listener = null; if(listeners != null && listeners.length >0){ listener = listeners[0]; checkBox.removeActionListener(listener); } checkBox.setSelected(isSelected); if(listener != null) checkBox.addActionListener(listener); }
private void updateTargetResolutions() { final Set<Resolution> resolutions = controller.getTargetResolutions(); for (JCheckBox checkBox : Arrays.asList(LDPICheckBox, MDPICheckBox, HDPICheckBox, XHDPICheckBox, XXHDPICheckBox, XXXHDPICheckBox, TVDPICheckBox)) { checkBox.removeActionListener(resolutionActionListener); final Resolution resolution = ((ResolutionButtonModel) checkBox.getModel()).getResolution(); checkBox.setSelected(resolutions.contains(resolution)); checkBox.addActionListener(resolutionActionListener); } }
private void updateExportResolutions() { final Set<Resolution> resolutions = controller.getExportResolutions(); for (JCheckBox checkBox : Arrays.asList(LDPICheckBox, MDPICheckBox, HDPICheckBox, XHDPICheckBox, XXHDPICheckBox, XXXHDPICheckBox, TVDPICheckBox)) { checkBox.removeActionListener(resolutionActionListener); final Resolution resolution = ((ResolutionButtonModel) checkBox.getModel()).getResolution(); checkBox.setSelected(resolutions.contains(resolution)); checkBox.addActionListener(resolutionActionListener); } }
private void updateTargetResolutions() { final Set<Resolution> resolutions = controller.getTargetResolutions(); for (JCheckBox checkBox : Arrays.asList(LDPICheckBox, MDPICheckBox, HDPICheckBox, XHDPICheckBox, XXHDPICheckBox, XXXHDPICheckBox, TVDPICheckBox)) { checkBox.removeActionListener(resolutionActionListener); final Resolution resolution = ((ResolutionButtonModel) checkBox.getModel()).getResolution(); checkBox.setSelected(resolutions.contains(resolution)); final int[] sizes = controller.getScaledSize(resolution); checkBox.setText(String.format("%s (%d px x %d px)", resolution, sizes[0], sizes[1])); checkBox.addActionListener(resolutionActionListener); } }
public void removeListener(SwingListener listener) { for ( JCheckBox b : multiCheckBox ) { b.removeActionListener(listener); } }
public void ancestorRemoved(AncestorEvent event) { component.removeActionListener(this); }
public void unbindFromPreferences(JCheckBox component, String key) { ActionListener actionListener = (ActionListener) bindings.remove(key); if(actionListener != null) { component.removeActionListener(actionListener); } }
protected static void setValue(JCheckBox checkBox, boolean isSelected){ ActionListener[] listeners = checkBox.getActionListeners(); ActionListener listener = null; if(listeners != null && listeners.length >0){ listener = listeners[0]; checkBox.removeActionListener(listener); } checkBox.setSelected(isSelected); if(listener != null) checkBox.addActionListener(listener); }
void cleanUp() { checkBox.removeActionListener(this); checkBox = null; this.removeAll(); }
void cleanUp() { if (checkBox != null) { checkBox.removeActionListener(this); checkBox = null; } this.removeAll(); }
private void refreshSpaceGround() { chkIncludeGround.removeActionListener(this); chkIncludeSpace.removeActionListener(this); boolean inSpace = mapSettings.getMedium() == MapSettings.MEDIUM_SPACE; chkIncludeSpace.setSelected(inSpace); chkIncludeGround.setSelected(!inSpace); comboMapType.setEnabled(!inSpace); butMapSize.setEnabled(!inSpace); comboMapSizes.setEnabled(!inSpace); buttonBoardPreview.setEnabled(!inSpace); lisBoardsSelected.setEnabled(!inSpace); butChange.setEnabled(!inSpace); lisBoardsAvailable.setEnabled(!inSpace); chkRotateBoard.setEnabled(!inSpace); butSpaceSize.setEnabled(inSpace); chkIncludeGround.addActionListener(this); chkIncludeSpace.addActionListener(this); }
void cleanUp() { if (textField != null && textField.getDocument() != null) { textField.getDocument().removeDocumentListener(this); } textField = null; unlockedCheckBox.removeActionListener(this); unlockedCheckBox = null; this.removeAll(); }
private void handleModeChange( boolean relative , boolean updateValues) { if( modeRelative == relative ) return; this.modeRelative = relative; toggleFixed.removeActionListener(this); toggleFixed.setSelected(relative); toggleFixed.addActionListener(this); if( updateValues ) { if (modeRelative) { updateValues(valueFraction.fraction, valueFraction.length); } else { updateValues(valueFixed.fraction, valueFixed.length); } } }
@Override public void dispose() { Collections.list(styleGroup.getElements()).forEach(button -> button.removeActionListener(this)); classNamePrefixField.getDocument().removeDocumentListener(this); classNameSuffixField.getDocument().removeDocumentListener(this); generatedAnnotationCheckBox.removeActionListener(this); suppressWarningsAnnotationCheckBox.removeActionListener(this); if (previewEditor == null || previewEditor.isDisposed()) { return; } EditorFactory.getInstance().releaseEditor(previewEditor); }
@Override protected void unregisterModel() { if (checkBoxListener != null) { getCheckBox().removeActionListener(checkBoxListener); } if (modelListener != null) { getModel().removeListCheckListener(modelListener); } checkBoxListener = null; modelListener = null; }
public void setConfiguration(ConfigThreshold configuration) { comboType.removeActionListener(this); spinnerScale.removeChangeListener(this); buttonUpDown.removeActionListener(this); checkOtsu2.removeActionListener(this); comboType.setSelectedIndex(configuration.type.ordinal()); controlWidth.setValue(configuration.width); spinnerScale.setValue(configuration.scale); buttonUpDown.setSelected(configuration.down); type = configuration.type; regionWidth = configuration.width.copy(); scale = configuration.scale; down = configuration.down; if( type == ThresholdType.FIXED ) { fixedThreshold = (int)configuration.fixedThreshold; } else if( type == ThresholdType.BLOCK_MIN_MAX) { minimumSpread = ((ConfigThresholdBlockMinMax)configuration).minimumSpread; } else if( type == ThresholdType.BLOCK_OTSU || type == ThresholdType.LOCAL_OTSU ) { otsuTuning = (int)((ConfigThresholdLocalOtsu)configuration).tuning; useOtsu2 = ((ConfigThresholdLocalOtsu)configuration).useOtsu2; } comboType.addActionListener(this); spinnerScale.addChangeListener(this); buttonUpDown.addActionListener(this); checkOtsu2.addActionListener(this); updateThresholdValue(); }
/** * Remove thsi SkinSpecEditor as a listener from all components. */ private void removeListeners() { skinSpecCompList.removeListSelectionListener(this); enableBorders.removeActionListener(this); currSkinCombo.removeActionListener(this); addButton.removeActionListener(this); addCompButton.removeActionListener(this); removeCompButton.removeActionListener(this); saveSkinButton.removeActionListener(this); resetSkinButton.removeActionListener(this); }
/** * Overwrite windowClosing to display the input image after closing * the GUI and shut down the executor service */ @Override public void windowClosing( WindowEvent e ) { super.windowClosing( e ); if( null != inputImage ) { if( null != displayImage ) inputImage.setSlice( displayImage.getCurrentSlice() ); // display input image inputImage.getWindow().setVisible( true ); } // remove listeners segmentButton.removeActionListener( listener ); resultDisplayList.removeActionListener( listener ); toggleOverlayCheckBox.removeActionListener( listener ); resultButton.removeActionListener( listener ); if( null != displayImage ) { //displayImage.close(); displayImage = null; } // shut down executor service exec.shutdownNow(); }
@Override public void initValues(AcquireImageInfo info, AcquireImageValues values) { ViewCanvas<ImageElement> view = EventManager.getInstance().getSelectedViewPane(); info.clearPreProcess(); AcquireImageValues next = info.getNextValues(); next.setContrast(values.getContrast()); next.setBrightness(values.getBrightness()); next.setAutoLevel(values.isAutoLevel()); autoLevelBtn.removeActionListener(autoLevelListener); contrastPanel.removeChangeListener(this); brightnessPanel.removeChangeListener(this); contrastPanel.setSliderValue(next.getContrast()); brightnessPanel.setSliderValue(next.getBrightness()); autoLevelBtn.setSelected(next.isAutoLevel()); autoLevelBtn.addActionListener(autoLevelListener); contrastPanel.addChangeListener(this); brightnessPanel.addChangeListener(this); repaint(); applyNextValues(); autoLevelListener.applyNextValues(); info.applyPreProcess(view); }