List of usage examples for java.awt Checkbox addItemListener
public synchronized void addItemListener(ItemListener l)
From source file:TextBouncer.java
protected Checkbox createCheckbox(String label, final int item) { Checkbox check = new Checkbox(label); check.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent ie) { setSwitch(item, (ie.getStateChange() == ie.SELECTED)); }// w w w. jav a2s . c om }); return check; }
From source file:interpolation.InterpolantFileChooser.java
public InterpolantFileChooser() { final JFrame frame = new JFrame("Welcome to the Regression fits"); Track = new JButton("Choose file"); panelCont.add(panelIntro, "1"); /* Instantiation */ final GridBagLayout layout = new GridBagLayout(); final GridBagConstraints c = new GridBagConstraints(); panelIntro.setLayout(layout);/*from w w w . j a v a2s. com*/ final Label LoadtrackText = new Label("Input the .txt file of time-series"); LoadtrackText.setBackground(new Color(1, 0, 1)); LoadtrackText.setForeground(new Color(255, 255, 255)); final Checkbox Simplemode = new Checkbox("Open simple time-series file", Simplefile); /* Location */ c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 0; c.weightx = 1; c.weighty = 1.5; ++c.gridy; c.insets = new Insets(10, 10, 10, 0); panelIntro.add(LoadtrackText, c); ++c.gridy; c.insets = new Insets(10, 10, 10, 0); panelIntro.add(Track, c); panelIntro.setVisible(true); Track.addActionListener(new OpenTrackListener(frame)); Simplemode.addItemListener(new SimpleListener(frame)); frame.addWindowListener(new FrameListener(frame)); frame.add(panelCont, BorderLayout.CENTER); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.pack(); frame.setVisible(true); }
From source file:gdsc.smlm.ij.plugins.PeakFit.java
private boolean getPeakWidth() { GenericDialog gd = newWizardDialog("Enter the expected peak width in pixels.", "A point source of light will not be focussed perfectly by the microscope but will appear as a spread out peak. This Point Spread Function (PSF) can be modelled using a 2D Gaussian curve.", "An optimised optical system (lens and camera sensor) should have a peak standard deviation of approximately 1 pixel when in focus. This allows the fitting routine to have enough data to identify the centre of the peak without spreading the light over too many pixels (which increases noise).", "The peak width can be estimated using the wavelength of light emitted by the single molecules and the parameters of the microscope. Use a PSF calculator by clicking the checkbox below:"); // Add ability to run the PSF Calculator to get the width gd.addCheckbox("Run_PSF_calculator", false); gd.addNumericField("Gaussian_SD", fitConfig.getInitialPeakStdDev0(), 3); if (!(java.awt.GraphicsEnvironment.isHeadless() || IJ.isMacro())) { Checkbox cb = (Checkbox) gd.getCheckboxes().get(0); cb.addItemListener(this); textInitialPeakStdDev0 = (TextField) gd.getNumericFields().get(0); }//from w ww. j av a2 s. c o m gd.showDialog(); if (gd.wasCanceled()) return false; fitConfig.setInitialPeakStdDev(Math.abs(gd.getNextNumber())); return true; }
From source file:gdsc.smlm.ij.plugins.CreateData.java
/** * Show a dialog allowing the parameters for a simulation to be performed * // w ww .j a v a2 s . co m * @return True if the parameters were collected */ private boolean showDialog() { GenericDialog gd = new GenericDialog(TITLE); globalSettings = SettingsManager.loadSettings(); settings = globalSettings.getCreateDataSettings(); if (settings.stepsPerSecond < 1) settings.stepsPerSecond = 1; String[] backgroundImages = createBackgroundImageList(); gd.addNumericField("Pixel_pitch (nm)", settings.pixelPitch, 2); gd.addNumericField("Size (px)", settings.size, 0); gd.addNumericField("Depth (nm)", settings.depth, 0); gd.addCheckbox("Fixed_depth", settings.fixedDepth); gd.addNumericField("Seconds", settings.seconds, 0); gd.addNumericField("Exposure_time (ms)", settings.exposureTime, 0); gd.addSlider("Steps_per_second", 1, 15, settings.stepsPerSecond); gd.addChoice("Illumination", ILLUMINATION, settings.illumination); gd.addNumericField("Pulse_interval", settings.pulseInterval, 0); gd.addNumericField("Pulse_ratio", settings.pulseRatio, 2); if (backgroundImages != null) gd.addChoice("Background_image", backgroundImages, settings.backgroundImage); if (extraOptions) gd.addCheckbox("No_poisson_noise", !settings.poissonNoise); gd.addNumericField("Background (photons)", settings.background, 2); gd.addNumericField("EM_gain", settings.getEmGain(), 2); gd.addNumericField("Camera_gain (ADU/e-)", settings.getCameraGain(), 4); gd.addNumericField("Quantum_efficiency", settings.getQuantumEfficiency(), 2); gd.addNumericField("Read_noise (e-)", settings.readNoise, 2); gd.addNumericField("Bias", settings.bias, 0); List<String> imageNames = addPSFOptions(gd); gd.addMessage("--- Fluorophores ---"); Component splitLabel = gd.getMessage(); gd.addChoice("Distribution", DISTRIBUTION, settings.distribution); gd.addNumericField("Particles", settings.particles, 0); gd.addCheckbox("Compound_molecules", settings.compoundMolecules); gd.addNumericField("Diffusion_rate (um^2/sec)", settings.diffusionRate, 2); gd.addCheckbox("Use_grid_walk", settings.useGridWalk); gd.addSlider("Fixed_fraction (%)", 0, 100, settings.fixedFraction * 100); gd.addChoice("Confinement", CONFINEMENT, settings.confinement); gd.addNumericField("Photons (sec^-1)", settings.photonsPerSecond, 0); gd.addCheckbox("Custom_photon_distribution", settings.customPhotonDistribution); gd.addNumericField("Photon shape", settings.photonShape, 2); gd.addNumericField("Correlation (to total tOn)", settings.correlation, 2); gd.addNumericField("On_time (ms)", settings.tOn, 2); gd.addNumericField("Off_time_short (ms)", settings.tOffShort, 2); gd.addNumericField("Off_time_long (ms)", settings.tOffLong, 2); gd.addNumericField("n_Blinks_Short", settings.nBlinksShort, 2); gd.addNumericField("n_Blinks_Long", settings.nBlinksLong, 2); gd.addCheckbox("Use_geometric_distribution", settings.nBlinksGeometricDistribution); gd.addMessage("--- Peak filtering ---"); gd.addSlider("Min_Photons", 0, 50, settings.minPhotons); gd.addSlider("Min_SNR_t1", 0, 20, settings.minSNRt1); gd.addSlider("Min_SNR_tN", 0, 10, settings.minSNRtN); gd.addMessage("--- Save options ---"); Component splitLabel2 = gd.getMessage(); gd.addCheckbox("Raw_image", settings.rawImage); gd.addCheckbox("Save_image", settings.saveImage); gd.addCheckbox("Save_image_results", settings.saveImageResults); gd.addCheckbox("Save_fluorophores", settings.saveFluorophores); gd.addCheckbox("Save_localisations", settings.saveLocalisations); gd.addMessage("--- Report options ---"); gd.addCheckbox("Show_histograms", settings.showHistograms); gd.addCheckbox("Choose_histograms", settings.chooseHistograms); gd.addNumericField("Histogram_bins", settings.histogramBins, 0); gd.addCheckbox("Remove_outliers", settings.removeOutliers); gd.addSlider("Density_radius (N x HWHM)", 0, 4.5, settings.densityRadius); // Split into two columns // Re-arrange the standard layout which has a GridBagLayout with 2 columns (label,field) // to 4 columns: (label,field) x 2 if (gd.getLayout() != null) { GridBagLayout grid = (GridBagLayout) gd.getLayout(); int xOffset = 0, yOffset = 0; int lastY = -1, rowCount = 0; for (Component comp : gd.getComponents()) { // Check if this should be the second major column if (comp == splitLabel || comp == splitLabel2) { xOffset += 2; yOffset -= rowCount; rowCount = 0; } // Reposition the field GridBagConstraints c = grid.getConstraints(comp); if (lastY != c.gridy) rowCount++; lastY = c.gridy; c.gridx = c.gridx + xOffset; c.gridy = c.gridy + yOffset; c.insets.left = c.insets.left + 10 * xOffset; c.insets.top = 0; c.insets.bottom = 0; grid.setConstraints(comp, c); } if (IJ.isLinux()) gd.setBackground(new Color(238, 238, 238)); } gd.showDialog(); if (gd.wasCanceled()) return false; settings.pixelPitch = Math.abs(gd.getNextNumber()); settings.size = Math.abs((int) gd.getNextNumber()); settings.depth = Math.abs(gd.getNextNumber()); settings.fixedDepth = gd.getNextBoolean(); settings.seconds = Math.abs((int) gd.getNextNumber()); settings.exposureTime = Math.abs((int) gd.getNextNumber()); settings.stepsPerSecond = Math.abs((int) gd.getNextNumber()); settings.illumination = gd.getNextChoice(); settings.pulseInterval = Math.abs((int) gd.getNextNumber()); settings.pulseRatio = Math.abs(gd.getNextNumber()); if (backgroundImages != null) settings.backgroundImage = gd.getNextChoice(); if (extraOptions) poissonNoise = settings.poissonNoise = !gd.getNextBoolean(); settings.background = Math.abs(gd.getNextNumber()); settings.setEmGain(Math.abs(gd.getNextNumber())); settings.setCameraGain(Math.abs(gd.getNextNumber())); settings.setQuantumEfficiency(Math.abs(gd.getNextNumber())); settings.readNoise = Math.abs(gd.getNextNumber()); settings.bias = Math.abs((int) gd.getNextNumber()); if (!collectPSFOptions(gd, imageNames)) return false; settings.distribution = gd.getNextChoice(); settings.particles = Math.abs((int) gd.getNextNumber()); settings.compoundMolecules = gd.getNextBoolean(); settings.diffusionRate = Math.abs(gd.getNextNumber()); settings.useGridWalk = gd.getNextBoolean(); settings.fixedFraction = Math.abs(gd.getNextNumber() / 100.0); settings.confinement = gd.getNextChoice(); settings.photonsPerSecond = Math.abs((int) gd.getNextNumber()); settings.customPhotonDistribution = gd.getNextBoolean(); settings.photonShape = Math.abs(gd.getNextNumber()); settings.correlation = gd.getNextNumber(); settings.tOn = Math.abs(gd.getNextNumber()); settings.tOffShort = Math.abs(gd.getNextNumber()); settings.tOffLong = Math.abs(gd.getNextNumber()); settings.nBlinksShort = Math.abs(gd.getNextNumber()); settings.nBlinksLong = Math.abs(gd.getNextNumber()); settings.nBlinksGeometricDistribution = gd.getNextBoolean(); minPhotons = settings.minPhotons = gd.getNextNumber(); minSNRt1 = settings.minSNRt1 = gd.getNextNumber(); minSNRtN = settings.minSNRtN = gd.getNextNumber(); settings.rawImage = gd.getNextBoolean(); settings.saveImage = gd.getNextBoolean(); settings.saveImageResults = gd.getNextBoolean(); settings.saveFluorophores = gd.getNextBoolean(); settings.saveLocalisations = gd.getNextBoolean(); settings.showHistograms = gd.getNextBoolean(); settings.chooseHistograms = gd.getNextBoolean(); settings.histogramBins = (int) gd.getNextNumber(); settings.removeOutliers = gd.getNextBoolean(); settings.densityRadius = (float) gd.getNextNumber(); // Ensure tN threshold is more lenient if (settings.minSNRt1 < settings.minSNRtN) { double tmp = settings.minSNRt1; settings.minSNRt1 = settings.minSNRtN; settings.minSNRtN = tmp; } // Save before validation so that the current values are preserved. SettingsManager.saveSettings(globalSettings); // Check arguments try { Parameters.isAboveZero("Pixel Pitch", settings.pixelPitch); Parameters.isAboveZero("Size", settings.size); if (!settings.fixedDepth) Parameters.isPositive("Depth", settings.depth); Parameters.isAboveZero("Seconds", settings.seconds); Parameters.isAboveZero("Exposure time", settings.exposureTime); Parameters.isAboveZero("Steps per second", settings.stepsPerSecond); Parameters.isPositive("Background", settings.background); Parameters.isPositive("EM gain", settings.getEmGain()); Parameters.isPositive("Camera gain", settings.getCameraGain()); Parameters.isPositive("Read noise", settings.readNoise); double noiseRange = settings.readNoise * settings.getCameraGain() * 4; Parameters.isEqualOrAbove("Bias must prevent clipping the read noise (@ +/- 4 StdDev) so ", settings.bias, noiseRange); Parameters.isAboveZero("Particles", settings.particles); Parameters.isAboveZero("Photons", settings.photonsPerSecond); Parameters.isEqualOrBelow("Correlation", settings.correlation, 1); Parameters.isEqualOrAbove("Correlation", settings.correlation, -1); if (!imagePSF) { Parameters.isAboveZero("Wavelength", settings.wavelength); Parameters.isAboveZero("NA", settings.numericalAperture); Parameters.isBelow("NA", settings.numericalAperture, 2); } Parameters.isPositive("Diffusion rate", settings.diffusionRate); Parameters.isPositive("Fixed fraction", settings.fixedFraction); Parameters.isPositive("Pulse interval", settings.pulseInterval); Parameters.isAboveZero("Pulse ratio", settings.pulseRatio); Parameters.isAboveZero("tOn", settings.tOn); Parameters.isAboveZero("tOff Short", settings.tOffShort); Parameters.isAboveZero("tOff Long", settings.tOffLong); Parameters.isPositive("n-Blinks Short", settings.nBlinksShort); Parameters.isPositive("n-Blinks Long", settings.nBlinksLong); Parameters.isPositive("Min photons", settings.minPhotons); Parameters.isPositive("Min SNR t1", settings.minSNRt1); Parameters.isPositive("Min SNR tN", settings.minSNRtN); Parameters.isAbove("Histogram bins", settings.histogramBins, 1); Parameters.isPositive("Density radius", settings.densityRadius); } catch (IllegalArgumentException e) { IJ.error(TITLE, e.getMessage()); return false; } if (gd.invalidNumber()) return false; if (!getHistogramOptions()) return false; String[] maskImages = null; if (settings.distribution.equals(DISTRIBUTION[MASK])) { maskImages = createDistributionImageList(); if (maskImages != null) { gd = new GenericDialog(TITLE); gd.addMessage("Select the mask image for the distribution"); gd.addChoice("Distribution_mask", maskImages, settings.distributionMask); if (maskListContainsStacks) gd.addNumericField("Distribution_slice_depth (nm)", settings.distributionMaskSliceDepth, 0); gd.showDialog(); if (gd.wasCanceled()) return false; settings.distributionMask = gd.getNextChoice(); if (maskListContainsStacks) settings.distributionMaskSliceDepth = Math.abs(gd.getNextNumber()); } } else if (settings.distribution.equals(DISTRIBUTION[GRID])) { gd = new GenericDialog(TITLE); gd.addMessage("Select grid for the distribution"); gd.addNumericField("Cell_size", settings.cellSize, 0); gd.addSlider("p-binary", 0, 1, settings.probabilityBinary); gd.addNumericField("Min_binary_distance (nm)", settings.minBinaryDistance, 0); gd.addNumericField("Max_binary_distance (nm)", settings.maxBinaryDistance, 0); gd.showDialog(); if (gd.wasCanceled()) return false; settings.cellSize = (int) gd.getNextNumber(); settings.probabilityBinary = gd.getNextNumber(); settings.minBinaryDistance = gd.getNextNumber(); settings.maxBinaryDistance = gd.getNextNumber(); // Check arguments try { Parameters.isAboveZero("Cell size", settings.cellSize); Parameters.isPositive("p-binary", settings.probabilityBinary); Parameters.isEqualOrBelow("p-binary", settings.probabilityBinary, 1); Parameters.isPositive("Min binary distance", settings.minBinaryDistance); Parameters.isPositive("Max binary distance", settings.maxBinaryDistance); Parameters.isEqualOrBelow("Min binary distance", settings.minBinaryDistance, settings.maxBinaryDistance); } catch (IllegalArgumentException e) { IJ.error(TITLE, e.getMessage()); return false; } } SettingsManager.saveSettings(globalSettings); if (settings.diffusionRate > 0 && settings.fixedFraction < 1) { if (settings.confinement.equals(CONFINEMENT[CONFINEMENT_SPHERE])) { gd = new GenericDialog(TITLE); gd.addMessage("Select the sphere radius for the diffusion confinement"); gd.addSlider("Confinement_radius (nm)", 0, 2000, settings.confinementRadius); gd.showDialog(); if (gd.wasCanceled()) return false; settings.confinementRadius = gd.getNextNumber(); } else if (settings.confinement.equals(CONFINEMENT[CONFINEMENT_MASK])) { if (maskImages == null) maskImages = createDistributionImageList(); if (maskImages != null) { gd = new GenericDialog(TITLE); gd.addMessage("Select the mask image for the diffusion confinement"); gd.addChoice("Confinement_mask", maskImages, settings.confinementMask); if (maskListContainsStacks) gd.addNumericField("Confinement_slice_depth (nm)", settings.confinementMaskSliceDepth, 0); gd.showDialog(); if (gd.wasCanceled()) return false; settings.confinementMask = gd.getNextChoice(); if (maskListContainsStacks) settings.confinementMaskSliceDepth = Math.abs(gd.getNextNumber()); } } } SettingsManager.saveSettings(globalSettings); if (settings.compoundMolecules) { // Show a second dialog where the molecule configuration is specified gd = new GenericDialog(TITLE); gd.addMessage("Specify the compound molecules"); gd.addTextAreas(settings.compoundText, null, 20, 80); gd.addCheckbox("Rotate_initial_orientation", settings.rotateInitialOrientation); gd.addCheckbox("Rotate_during_simulation", settings.rotateDuringSimulation); gd.addCheckbox("Enable_2D_rotation", settings.rotate2D); gd.addCheckbox("Show_example_compounds", false); if (!(java.awt.GraphicsEnvironment.isHeadless() || IJ.isMacro())) { @SuppressWarnings("rawtypes") Vector v = gd.getCheckboxes(); Checkbox cb = (Checkbox) v.get(v.size() - 1); cb.addItemListener(this); } gd.showDialog(); if (gd.wasCanceled()) return false; settings.compoundText = gd.getNextText(); settings.rotateInitialOrientation = gd.getNextBoolean(); settings.rotateDuringSimulation = gd.getNextBoolean(); settings.rotate2D = gd.getNextBoolean(); if (gd.getNextBoolean()) { logExampleCompounds(); return false; } } SettingsManager.saveSettings(globalSettings); return true; }
From source file:mt.listeners.InteractiveRANSAC.java
public void CardTable() { this.lambdaSB = new Scrollbar(Scrollbar.HORIZONTAL, this.lambdaInt, 1, MIN_SLIDER, MAX_SLIDER + 1); maxSlopeSB.setValue(utility.Slicer.computeScrollbarPositionFromValue((float) maxSlope, (float) MIN_ABS_SLOPE, (float) MAX_ABS_SLOPE, scrollbarSize)); maxDistSB.setValue(// ww w.ja va 2 s . c o m utility.Slicer.computeScrollbarPositionFromValue(maxDist, MIN_Gap, MAX_Gap, scrollbarSize)); minInliersSB.setValue(utility.Slicer.computeScrollbarPositionFromValue(minInliers, MIN_Inlier, MAX_Inlier, scrollbarSize)); maxErrorSB.setValue( utility.Slicer.computeScrollbarPositionFromValue(maxError, MIN_ERROR, MAX_ERROR, scrollbarSize)); minSlopeSB.setValue(utility.Slicer.computeScrollbarPositionFromValue((float) minSlope, (float) MIN_ABS_SLOPE, (float) MAX_ABS_SLOPE, scrollbarSize)); lambdaLabel = new Label("Linearity (fraction) = " + new DecimalFormat("#.##").format(lambda), Label.CENTER); maxErrorLabel = new Label("Maximum Error (px) = " + new DecimalFormat("#.##").format(maxError) + " ", Label.CENTER); minInliersLabel = new Label( "Minimum No. of timepoints (tp) = " + new DecimalFormat("#.##").format(minInliers), Label.CENTER); maxDistLabel = new Label("Maximum Gap (tp) = " + new DecimalFormat("#.##").format(maxDist), Label.CENTER); minSlopeLabel = new Label("Min. Segment Slope (px/tp) = " + new DecimalFormat("#.##").format(minSlope), Label.CENTER); maxSlopeLabel = new Label("Max. Segment Slope (px/tp) = " + new DecimalFormat("#.##").format(maxSlope), Label.CENTER); maxResLabel = new Label( "MT is rescued if the start of event# i + 1 > start of event# i by px = " + this.restolerance, Label.CENTER); CardLayout cl = new CardLayout(); Object[] colnames = new Object[] { "Track File", "Growth velocity", "Shrink velocity", "Growth events", "Shrink events", "fcat", "fres", "Error" }; Object[][] rowvalues = new Object[0][colnames.length]; if (inputfiles != null) { rowvalues = new Object[inputfiles.length][colnames.length]; for (int i = 0; i < inputfiles.length; ++i) { rowvalues[i][0] = inputfiles[i].getName(); } } table = new JTable(rowvalues, colnames); table.setFillsViewportHeight(true); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); table.isOpaque(); int size = 100; table.getColumnModel().getColumn(0).setPreferredWidth(size); table.getColumnModel().getColumn(1).setPreferredWidth(size); table.getColumnModel().getColumn(2).setPreferredWidth(size); table.getColumnModel().getColumn(3).setPreferredWidth(size); table.getColumnModel().getColumn(4).setPreferredWidth(size); table.getColumnModel().getColumn(5).setPreferredWidth(size); table.getColumnModel().getColumn(6).setPreferredWidth(size); table.getColumnModel().getColumn(7).setPreferredWidth(size); maxErrorField = new TextField(5); maxErrorField.setText(Float.toString(maxError)); minInlierField = new TextField(5); minInlierField.setText(Float.toString(minInliers)); maxGapField = new TextField(5); maxGapField.setText(Float.toString(maxDist)); maxSlopeField = new TextField(5); maxSlopeField.setText(Float.toString(maxSlope)); minSlopeField = new TextField(5); minSlopeField.setText(Float.toString(minSlope)); maxErrorSB.setSize(new Dimension(SizeX, 20)); minSlopeSB.setSize(new Dimension(SizeX, 20)); minInliersSB.setSize(new Dimension(SizeX, 20)); maxDistSB.setSize(new Dimension(SizeX, 20)); maxSlopeSB.setSize(new Dimension(SizeX, 20)); maxErrorField.setSize(new Dimension(SizeX, 20)); minInlierField.setSize(new Dimension(SizeX, 20)); maxGapField.setSize(new Dimension(SizeX, 20)); minSlopeField.setSize(new Dimension(SizeX, 20)); maxSlopeField.setSize(new Dimension(SizeX, 20)); scrollPane = new JScrollPane(table); scrollPane.setMinimumSize(new Dimension(300, 200)); scrollPane.setPreferredSize(new Dimension(300, 200)); scrollPane.getViewport().add(table); scrollPane.setAutoscrolls(true); // Location panelFirst.setLayout(layout); panelSecond.setLayout(layout); PanelSavetoFile.setLayout(layout); PanelParameteroptions.setLayout(layout); Panelfunction.setLayout(layout); Panelslope.setLayout(layout); PanelCompileRes.setLayout(layout); PanelDirectory.setLayout(layout); panelCont.setLayout(cl); panelCont.add(panelFirst, "1"); panelCont.add(panelSecond, "2"); panelFirst.setName("Ransac fits for rates and frequency analysis"); c.insets = new Insets(5, 5, 5, 5); c.anchor = GridBagConstraints.BOTH; c.ipadx = 35; inputLabelT = new Label("Compute length distribution at time: "); inputLabelTcont = new Label("(Press Enter to start computation) "); inputFieldT = new TextField(5); inputFieldT.setText("1"); c.gridwidth = 10; c.gridheight = 10; c.gridy = 1; c.gridx = 0; String[] Method = { "Linear Function only", "Linearized Quadratic function", "Linearized Cubic function" }; JComboBox<String> ChooseMethod = new JComboBox<String>(Method); final Checkbox findCatastrophe = new Checkbox("Detect Catastrophies", this.detectCatastrophe); final Checkbox findmanualCatastrophe = new Checkbox("Detect Catastrophies without fit", this.detectmanualCatastrophe); final Scrollbar minCatDist = new Scrollbar(Scrollbar.HORIZONTAL, this.minDistCatInt, 1, MIN_SLIDER, MAX_SLIDER + 1); final Scrollbar maxRes = new Scrollbar(Scrollbar.HORIZONTAL, this.restoleranceInt, 1, MIN_SLIDER, MAX_SLIDER + 1); final Label minCatDistLabel = new Label("Min. Catastrophy height (tp) = " + this.minDistanceCatastrophe, Label.CENTER); final Button done = new Button("Done"); final Button batch = new Button("Save Parameters for Batch run"); final Button cancel = new Button("Cancel"); final Button Compile = new Button("Compute rates and freq. till current file"); final Button AutoCompile = new Button("Auto Compute Velocity and Frequencies"); final Button Measureserial = new Button("Select directory of MTrack generated files"); final Button WriteLength = new Button("Compute length distribution at framenumber : "); final Button WriteStats = new Button("Compute lifetime and mean length distribution"); final Button WriteAgain = new Button("Save Velocity and Frequencies to File"); PanelDirectory.add(Measureserial, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); PanelDirectory.add(scrollPane, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); PanelDirectory.setBorder(selectdirectory); PanelDirectory.setPreferredSize(new Dimension(SizeX, SizeY)); panelFirst.add(PanelDirectory, new GridBagConstraints(0, 0, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); SliderBoxGUI combomaxerror = new SliderBoxGUI(errorstring, maxErrorSB, maxErrorField, maxErrorLabel, scrollbarSize, maxError, MAX_ERROR); PanelParameteroptions.add(combomaxerror.BuildDisplay(), new GridBagConstraints(0, 0, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); SliderBoxGUI combomininlier = new SliderBoxGUI(inlierstring, minInliersSB, minInlierField, minInliersLabel, scrollbarSize, minInliers, MAX_Inlier); PanelParameteroptions.add(combomininlier.BuildDisplay(), new GridBagConstraints(0, 2, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); SliderBoxGUI combomaxdist = new SliderBoxGUI(maxgapstring, maxDistSB, maxGapField, maxDistLabel, scrollbarSize, maxDist, MAX_Gap); PanelParameteroptions.add(combomaxdist.BuildDisplay(), new GridBagConstraints(0, 3, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); PanelParameteroptions.add(ChooseMethod, new GridBagConstraints(0, 4, 3, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); PanelParameteroptions.add(lambdaSB, new GridBagConstraints(0, 5, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insets, 0, 0)); PanelParameteroptions.add(lambdaLabel, new GridBagConstraints(0, 6, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insets, 0, 0)); PanelParameteroptions.setPreferredSize(new Dimension(SizeX, SizeY)); PanelParameteroptions.setBorder(selectparam); panelFirst.add(PanelParameteroptions, new GridBagConstraints(3, 0, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); SliderBoxGUI combominslope = new SliderBoxGUI(minslopestring, minSlopeSB, minSlopeField, minSlopeLabel, scrollbarSize, (float) minSlope, (float) MAX_ABS_SLOPE); Panelslope.add(combominslope.BuildDisplay(), new GridBagConstraints(0, 0, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); SliderBoxGUI combomaxslope = new SliderBoxGUI(maxslopestring, maxSlopeSB, maxSlopeField, maxSlopeLabel, scrollbarSize, (float) maxSlope, (float) MAX_ABS_SLOPE); Panelslope.add(combomaxslope.BuildDisplay(), new GridBagConstraints(0, 2, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); Panelslope.add(findCatastrophe, new GridBagConstraints(0, 4, 3, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, insets, 0, 0)); Panelslope.add(findmanualCatastrophe, new GridBagConstraints(4, 4, 3, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, insets, 0, 0)); Panelslope.add(minCatDist, new GridBagConstraints(0, 5, 3, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, insets, 0, 0)); Panelslope.add(minCatDistLabel, new GridBagConstraints(0, 6, 3, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, insets, 0, 0)); Panelslope.setBorder(selectslope); Panelslope.setPreferredSize(new Dimension(SizeX, SizeY)); panelFirst.add(Panelslope, new GridBagConstraints(3, 1, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); PanelCompileRes.add(AutoCompile, new GridBagConstraints(0, 0, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); PanelCompileRes.add(WriteLength, new GridBagConstraints(0, 1, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insets, 0, 0)); PanelCompileRes.add(inputFieldT, new GridBagConstraints(3, 1, 3, 1, 0.1, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insets, 0, 0)); PanelCompileRes.add(WriteStats, new GridBagConstraints(0, 4, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); PanelCompileRes.setPreferredSize(new Dimension(SizeX, SizeY)); PanelCompileRes.setBorder(compileres); panelFirst.add(PanelCompileRes, new GridBagConstraints(0, 1, 3, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, insets, 0, 0)); if (inputfiles != null) { table.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() >= 1) { if (!jFreeChartFrame.isVisible()) jFreeChartFrame = Tracking.display(chart, new Dimension(500, 500)); JTable target = (JTable) e.getSource(); row = target.getSelectedRow(); // do some action if appropriate column if (row > 0) displayclicked(row); else displayclicked(0); } } }); } maxErrorSB.addAdjustmentListener(new ErrorListener(this, maxErrorLabel, errorstring, MIN_ERROR, MAX_ERROR, scrollbarSize, maxErrorSB)); minInliersSB.addAdjustmentListener(new MinInlierListener(this, minInliersLabel, inlierstring, MIN_Inlier, MAX_Inlier, scrollbarSize, minInliersSB)); maxDistSB.addAdjustmentListener( new MaxDistListener(this, maxDistLabel, maxgapstring, MIN_Gap, MAX_Gap, scrollbarSize, maxDistSB)); ChooseMethod.addActionListener(new FunctionItemListener(this, ChooseMethod)); lambdaSB.addAdjustmentListener(new LambdaListener(this, lambdaLabel, lambdaSB)); minSlopeSB.addAdjustmentListener(new MinSlopeListener(this, minSlopeLabel, minslopestring, (float) MIN_ABS_SLOPE, (float) MAX_ABS_SLOPE, scrollbarSize, minSlopeSB)); maxSlopeSB.addAdjustmentListener(new MaxSlopeListener(this, maxSlopeLabel, maxslopestring, (float) MIN_ABS_SLOPE, (float) MAX_ABS_SLOPE, scrollbarSize, maxSlopeSB)); findCatastrophe.addItemListener( new CatastrophyCheckBoxListener(this, findCatastrophe, minCatDistLabel, minCatDist)); findmanualCatastrophe.addItemListener( new ManualCatastrophyCheckBoxListener(this, findmanualCatastrophe, minCatDistLabel, minCatDist)); minCatDist.addAdjustmentListener(new MinCatastrophyDistanceListener(this, minCatDistLabel, minCatDist)); Measureserial.addActionListener(new MeasureserialListener(this)); Compile.addActionListener(new CompileResultsListener(this)); AutoCompile.addActionListener(new AutoCompileResultsListener(this)); WriteLength.addActionListener(new WriteLengthListener(this)); WriteStats.addActionListener(new WriteStatsListener(this)); WriteAgain.addActionListener(new WriteRatesListener(this)); done.addActionListener(new FinishButtonListener(this, false)); batch.addActionListener(new RansacBatchmodeListener(this)); cancel.addActionListener(new FinishButtonListener(this, true)); inputFieldT.addTextListener(new LengthdistroListener(this)); maxSlopeField.addTextListener(new MaxSlopeLocListener(this, false)); minSlopeField.addTextListener(new MinSlopeLocListener(this, false)); maxErrorField.addTextListener(new ErrorLocListener(this, false)); minInlierField.addTextListener(new MinInlierLocListener(this, false)); maxGapField.addTextListener(new MaxDistLocListener(this, false)); panelFirst.setVisible(true); functionChoice = 0; cl.show(panelCont, "1"); Cardframe.add(panelCont, BorderLayout.CENTER); setFunction(); Cardframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); Cardframe.pack(); Cardframe.setVisible(true); Cardframe.pack(); }
From source file:org.apache.oodt.cas.workflow.gui.perspective.view.impl.DefaultPropView.java
private JPanel getOptional(final ModelGraph graph, final ViewState state) { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.setBorder(new EtchedBorder()); panel.add(new JLabel("Optional:"), BorderLayout.NORTH); JPanel checkBoxes = new JPanel(); checkBoxes.setLayout(new GridLayout(1, 1)); Checkbox checkbox = new Checkbox("ignore", graph.getModel().isOptional()); checkBoxes.add(checkbox);//from www . j a v a2s.c om checkbox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.DESELECTED) { graph.getModel().setOptional(false); } else if (e.getStateChange() == ItemEvent.SELECTED) { graph.getModel().setOptional(true); } else { return; } DefaultPropView.this.notifyListeners(); DefaultPropView.this.refreshView(state); } }); panel.add(checkBoxes, BorderLayout.CENTER); return panel; }
From source file:org.apache.oodt.cas.workflow.gui.perspective.view.impl.DefaultPropView.java
private JPanel getExecusedIds(final ModelGraph graph) { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.setBorder(new EtchedBorder()); panel.add(new JLabel("ExcusedSubProcessorIds:"), BorderLayout.NORTH); JPanel checkBoxes = new JPanel(); checkBoxes.setLayout(new GridLayout(graph.getChildren().size(), 1)); if (graph.hasChildren()) { for (ModelGraph childGraph : graph.getChildren()) { final String modelId = childGraph.getModel().getModelId(); Checkbox checkbox = new Checkbox(modelId, graph.getModel().getExcusedSubProcessorIds().contains(modelId)); checkBoxes.add(checkbox);/*from w w w .j av a 2 s .c o m*/ checkbox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.DESELECTED) { graph.getModel().getExcusedSubProcessorIds().remove(modelId); } else if (e.getStateChange() == ItemEvent.SELECTED) { graph.getModel().getExcusedSubProcessorIds().add(modelId); } else { return; } DefaultPropView.this.notifyListeners(); } }); } } panel.add(checkBoxes, BorderLayout.CENTER); return panel; }