Example usage for java.awt Choice setEnabled

List of usage examples for java.awt Choice setEnabled

Introduction

In this page you can find the example usage for java.awt Choice setEnabled.

Prototype

public void setEnabled(boolean b) 

Source Link

Document

Enables or disables this component, depending on the value of the parameter b .

Usage

From source file:ipnat.skel.Strahler.java

@Override
public boolean dialogItemChanged(final GenericDialog gd, final java.awt.AWTEvent e) {

    protectRoot = gd.getNextBoolean();/*from  w  ww.ja v  a 2s .  c  o m*/
    erodeIsolatedPixels = gd.getNextBoolean();
    pruneChoice = gd.getNextChoiceIndex();
    grayscaleImpChoice = gd.getNextChoiceIndex();
    outIS = gd.getNextBoolean();
    verbose = gd.getNextBoolean();
    tabular = gd.getNextBoolean();

    // Enable/Disable key components of GenericDialog
    if (!IJ.macroRunning()) {
        final Choice cImgChoice = (Choice) gd.getChoices().elementAt(1);
        final Vector<?> checkboxes = gd.getCheckboxes();
        final Checkbox roiOption = (Checkbox) checkboxes.elementAt(0);
        final Checkbox stackOption = (Checkbox) checkboxes.elementAt(2);

        cImgChoice.setEnabled(pruneChoice == AnalyzeSkeleton_.LOWEST_INTENSITY_VOXEL
                || pruneChoice == AnalyzeSkeleton_.LOWEST_INTENSITY_BRANCH);
        roiOption.setEnabled(validRootRoi);
        stackOption.setEnabled(!tabular);

    }

    return !gd.wasCanceled();

}