Search in sources :

Example 1 with Label

use of java.awt.Label in project voltdb by VoltDB.

the class ZaurusEditor method initGUI.

private void initGUI() {
    // without connection there are no tables
    // vAllTables is a local variable with all table names in the database
    // vHoldTableNames holds the table names which have a ZaurusTableForm
    Vector vAllTables = getAllTables();
    if (vAllTables == null) {
        return;
    }
    // initialize a new list for the table names which have a form in pForm
    vHoldTableNames = new Vector(20);
    vHoldForms = new Vector(20);
    // this holds the card panel pForm for the forms in the top
    // a card panel pButton below
    // the both card panels form a panel which is centered in this
    // and a status line in the south
    this.setLayout(new BorderLayout(3, 3));
    // >>> the top of this: the entry forms in pForm
    // pFormButs holds in the center the forms card panel pForm and
    // in the south the button card panel pButton
    Panel pFormButs = new Panel();
    pFormButs.setLayout(new BorderLayout(3, 3));
    pForm = new Panel();
    lForm = new CardLayout(2, 2);
    pForm.setLayout(lForm);
    // the search panel containing the list of all tables and
    // the entry fields for search words in the Center
    Panel pEntry = new Panel();
    pEntry.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets = new Insets(3, 3, 3, 3);
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = c.weighty = 1;
    c.anchor = GridBagConstraints.WEST;
    c.gridy = 0;
    c.gridx = 0;
    pEntry.add(new Label("Search table"), c);
    c.gridx = 1;
    // get all table names and show a drop down list of them in cTables
    cTables = new Choice();
    for (Enumeration e = vAllTables.elements(); e.hasMoreElements(); ) {
        cTables.addItem((String) e.nextElement());
    }
    c.gridwidth = 2;
    pEntry.add(cTables, c);
    c.gridy = 1;
    c.gridx = 0;
    c.gridwidth = 1;
    pEntry.add(new Label("Search words"), c);
    c.gridx = 1;
    c.gridwidth = 2;
    fSearchWords = new TextField(8);
    pEntry.add(fSearchWords, c);
    // use search words
    c.gridwidth = 1;
    c.gridy = 2;
    c.gridx = 0;
    pEntry.add(new Label("Use search words"), c);
    gAllWords = new CheckboxGroup();
    Checkbox[] checkboxes = new Checkbox[2];
    checkboxes[0] = new Checkbox("all", gAllWords, true);
    c.gridx = 1;
    pEntry.add(checkboxes[0], c);
    checkboxes[1] = new Checkbox("any ", gAllWords, false);
    c.gridx = 2;
    pEntry.add(checkboxes[1], c);
    // ignore case
    c.gridy = 3;
    c.gridx = 0;
    pEntry.add(new Label("Ignore case"), c);
    gIgnoreCase = new CheckboxGroup();
    Checkbox[] checkboxes1 = new Checkbox[2];
    checkboxes1[0] = new Checkbox("yes", gIgnoreCase, true);
    c.gridx = 1;
    pEntry.add(checkboxes1[0], c);
    checkboxes1[1] = new Checkbox("no", gIgnoreCase, false);
    c.gridx = 2;
    pEntry.add(checkboxes1[1], c);
    // Match column exactly
    c.gridy = 4;
    c.gridx = 0;
    pEntry.add(new Label("Match whole col"), c);
    gNoMatchWhole = new CheckboxGroup();
    Checkbox[] checkboxes2 = new Checkbox[2];
    checkboxes2[0] = new Checkbox("no", gNoMatchWhole, true);
    c.gridx = 1;
    pEntry.add(checkboxes2[0], c);
    checkboxes2[1] = new Checkbox("yes ", gNoMatchWhole, false);
    c.gridx = 2;
    pEntry.add(checkboxes2[1], c);
    pForm.add("search", pEntry);
    pFormButs.add("Center", pForm);
    // the buttons
    this.initButtons();
    pButton = new Panel();
    lButton = new CardLayout(2, 2);
    pButton.setLayout(lButton);
    pButton.add("search", pSearchButs);
    pButton.add("edit", pEditButs);
    pButton.add("insert", pInsertButs);
    pFormButs.add("South", pButton);
    this.add("Center", pFormButs);
    // >>> the South: status line at the bottom
    Font fFont = new Font("Dialog", Font.PLAIN, 10);
    ZaurusEditor.tStatus = new TextField("");
    ZaurusEditor.tStatus.setEditable(false);
    this.add("South", ZaurusEditor.tStatus);
}
Also used : CardLayout(java.awt.CardLayout) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) Choice(java.awt.Choice) Enumeration(java.util.Enumeration) GridBagLayout(java.awt.GridBagLayout) CheckboxGroup(java.awt.CheckboxGroup) Label(java.awt.Label) Font(java.awt.Font) Panel(java.awt.Panel) BorderLayout(java.awt.BorderLayout) Checkbox(java.awt.Checkbox) TextField(java.awt.TextField) Vector(java.util.Vector)

Example 2 with Label

use of java.awt.Label in project jdk8u_jdk by JetBrains.

the class DimensionEncapsulation method run.

@Override
public void run() {
    runTest(new Panel());
    runTest(new Button());
    runTest(new Checkbox());
    runTest(new Canvas());
    runTest(new Choice());
    runTest(new Label());
    runTest(new Scrollbar());
    runTest(new TextArea());
    runTest(new TextField());
    runTest(new Dialog(new JFrame()));
    runTest(new Frame());
    runTest(new Window(new JFrame()));
    runTest(new FileDialog(new JFrame()));
    runTest(new List());
    runTest(new ScrollPane());
    runTest(new JFrame());
    runTest(new JDialog(new JFrame()));
    runTest(new JWindow(new JFrame()));
    runTest(new JLabel("hi"));
    runTest(new JMenu());
    runTest(new JTree());
    runTest(new JTable());
    runTest(new JMenuItem());
    runTest(new JCheckBoxMenuItem());
    runTest(new JToggleButton());
    runTest(new JSpinner());
    runTest(new JSlider());
    runTest(Box.createVerticalBox());
    runTest(Box.createHorizontalBox());
    runTest(new JTextField());
    runTest(new JTextArea());
    runTest(new JTextPane());
    runTest(new JPasswordField());
    runTest(new JFormattedTextField());
    runTest(new JEditorPane());
    runTest(new JButton());
    runTest(new JColorChooser());
    runTest(new JFileChooser());
    runTest(new JCheckBox());
    runTest(new JInternalFrame());
    runTest(new JDesktopPane());
    runTest(new JTableHeader());
    runTest(new JLayeredPane());
    runTest(new JRootPane());
    runTest(new JMenuBar());
    runTest(new JOptionPane());
    runTest(new JRadioButton());
    runTest(new JRadioButtonMenuItem());
    runTest(new JPopupMenu());
    //runTest(new JScrollBar()); --> don't test defines max and min in
    // terms of preferred
    runTest(new JScrollPane());
    runTest(new JViewport());
    runTest(new JSplitPane());
    runTest(new JTabbedPane());
    runTest(new JToolBar());
    runTest(new JSeparator());
    runTest(new JProgressBar());
    if (!failures.isEmpty()) {
        System.out.println("These classes failed");
        for (final Component failure : failures) {
            System.out.println(failure.getClass());
        }
        throw new RuntimeException("Test failed");
    }
}
Also used : JDesktopPane(javax.swing.JDesktopPane) Choice(java.awt.Choice) JTextArea(javax.swing.JTextArea) TextArea(java.awt.TextArea) JTextArea(javax.swing.JTextArea) Label(java.awt.Label) JLabel(javax.swing.JLabel) JTableHeader(javax.swing.table.JTableHeader) JToggleButton(javax.swing.JToggleButton) JToggleButton(javax.swing.JToggleButton) Button(java.awt.Button) JRadioButton(javax.swing.JRadioButton) JButton(javax.swing.JButton) JFrame(javax.swing.JFrame) Checkbox(java.awt.Checkbox) JDialog(javax.swing.JDialog) FileDialog(java.awt.FileDialog) Dialog(java.awt.Dialog) JTextField(javax.swing.JTextField) TextField(java.awt.TextField) JFormattedTextField(javax.swing.JFormattedTextField) JSlider(javax.swing.JSlider) ArrayList(java.util.ArrayList) List(java.awt.List) Canvas(java.awt.Canvas) JWindow(javax.swing.JWindow) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) JOptionPane(javax.swing.JOptionPane) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem) JCheckBox(javax.swing.JCheckBox) JTree(javax.swing.JTree) JFileChooser(javax.swing.JFileChooser) JPasswordField(javax.swing.JPasswordField) ScrollPane(java.awt.ScrollPane) JScrollPane(javax.swing.JScrollPane) JTable(javax.swing.JTable) JSpinner(javax.swing.JSpinner) JSplitPane(javax.swing.JSplitPane) JColorChooser(javax.swing.JColorChooser) JInternalFrame(javax.swing.JInternalFrame) JDialog(javax.swing.JDialog) JFrame(javax.swing.JFrame) Frame(java.awt.Frame) JInternalFrame(javax.swing.JInternalFrame) JRadioButton(javax.swing.JRadioButton) JLayeredPane(javax.swing.JLayeredPane) JTabbedPane(javax.swing.JTabbedPane) JButton(javax.swing.JButton) JProgressBar(javax.swing.JProgressBar) JTextField(javax.swing.JTextField) JSeparator(javax.swing.JSeparator) JTextPane(javax.swing.JTextPane) JMenuItem(javax.swing.JMenuItem) Component(java.awt.Component) Scrollbar(java.awt.Scrollbar) Window(java.awt.Window) JWindow(javax.swing.JWindow) JScrollPane(javax.swing.JScrollPane) JViewport(javax.swing.JViewport) JFormattedTextField(javax.swing.JFormattedTextField) JLabel(javax.swing.JLabel) JToolBar(javax.swing.JToolBar) JPopupMenu(javax.swing.JPopupMenu) Panel(java.awt.Panel) JEditorPane(javax.swing.JEditorPane) JRootPane(javax.swing.JRootPane) FileDialog(java.awt.FileDialog) JMenu(javax.swing.JMenu) JMenuBar(javax.swing.JMenuBar)

Example 3 with Label

use of java.awt.Label in project GDSC-SMLM by aherbert.

the class FolderOpenerDialog method setStackInfo.

void setStackInfo() {
    int n = getNumber(numberField.elementAt(0));
    int start = getNumber(numberField.elementAt(1));
    int inc = getNumber(numberField.elementAt(2));
    // Filter by name
    TextField tf = (TextField) stringField.elementAt(0);
    String filter = tf.getText();
    tf = (TextField) stringField.elementAt(1);
    String regex = tf.getText();
    java.util.regex.Pattern p = null;
    if (!regex.equals("")) {
        filter = regex;
        p = java.util.regex.Pattern.compile(filter);
    }
    if (!filter.equals("") && !filter.equals("*")) {
        int n2 = 0;
        for (int i = 0; i < list.length; i++) {
            if (p != null && p.matcher(list[i]).matches())
                n2++;
            else if (list[i].indexOf(filter) >= 0)
                n2++;
        }
        if (n2 < n)
            n = n2;
    }
    // Now count using the input settings
    if (start < 1 || start > n)
        start = 1;
    if (inc < 1)
        inc = 1;
    int count = 0;
    for (int i = start - 1; i < list.length && count < n; i += inc, count++) ;
    int frames = imp.getStackSize() * count;
    ((Label) theLabel).setText(String.format("%d image%s (%d frame%s)", count, (count == 1) ? "" : "s", frames, (frames == 1) ? "" : "s"));
}
Also used : Label(java.awt.Label) TextField(java.awt.TextField)

Example 4 with Label

use of java.awt.Label in project GDSC-SMLM by aherbert.

the class FIRE method showDialog.

private boolean showDialog() {
    ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
    gd.addMessage("Compute the resolution using Fourier Ring Correlation");
    gd.addHelp(About.HELP_URL);
    boolean single = results2 == null;
    gd.addMessage("Image construction options:");
    gd.addChoice("Image_scale", SCALE_ITEMS, SCALE_ITEMS[imageScaleIndex]);
    gd.addChoice("Auto_image_size", IMAGE_SIZE_ITEMS, IMAGE_SIZE_ITEMS[imageSizeIndex]);
    if (extraOptions)
        gd.addCheckbox("Use_signal (if present)", useSignal);
    gd.addNumericField("Max_per_bin", maxPerBin, 0);
    gd.addMessage("Fourier options:");
    String[] fourierMethodNames = SettingsManager.getNames((Object[]) FRC.FourierMethod.values());
    gd.addChoice("Fourier_method", fourierMethodNames, fourierMethodNames[fourierMethodIndex]);
    String[] samplingMethodNames = SettingsManager.getNames((Object[]) FRC.SamplingMethod.values());
    gd.addChoice("Sampling_method", samplingMethodNames, samplingMethodNames[samplingMethodIndex]);
    gd.addSlider("Sampling_factor", 0.2, 4, perimeterSamplingFactor);
    gd.addMessage("FIRE options:");
    String[] thresholdMethodNames = SettingsManager.getNames((Object[]) FRC.ThresholdMethod.values());
    gd.addChoice("Threshold_method", thresholdMethodNames, thresholdMethodNames[thresholdMethodIndex]);
    gd.addCheckbox("Show_FRC_curve", showFRCCurve);
    if (single) {
        gd.addMessage("For single datasets:");
        Label l = (Label) gd.getMessage();
        gd.addNumericField("Block_size", blockSize, 0);
        gd.addCheckbox("Random_split", randomSplit);
        gd.addNumericField("Repeats", repeats, 0);
        gd.addCheckbox("Show_FRC_curve_repeats", showFRCCurveRepeats);
        gd.addCheckbox("Show_FRC_time_evolution", showFRCTimeEvolution);
        gd.addCheckbox("Spurious correlation correction", spuriousCorrelationCorrection);
        gd.addNumericField("Q-value", qValue, 3);
        gd.addNumericField("Precision_Mean", mean, 2, 6, "nm");
        gd.addNumericField("Precision_Sigma", sigma, 2, 6, "nm");
        if (extraOptions)
            gd.addNumericField("Threads", getLastNThreads(), 0);
        // Rearrange the dialog
        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 == l) {
                    xOffset += 2;
                    // Skip title row
                    yOffset = yOffset - rowCount + 1;
                }
                // 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;
    imageScaleIndex = gd.getNextChoiceIndex();
    imageSizeIndex = gd.getNextChoiceIndex();
    if (extraOptions)
        myUseSignal = useSignal = gd.getNextBoolean();
    maxPerBin = Math.abs((int) gd.getNextNumber());
    fourierMethodIndex = gd.getNextChoiceIndex();
    fourierMethod = FourierMethod.values()[fourierMethodIndex];
    samplingMethodIndex = gd.getNextChoiceIndex();
    samplingMethod = SamplingMethod.values()[samplingMethodIndex];
    perimeterSamplingFactor = gd.getNextNumber();
    thresholdMethodIndex = gd.getNextChoiceIndex();
    thresholdMethod = FRC.ThresholdMethod.values()[thresholdMethodIndex];
    showFRCCurve = gd.getNextBoolean();
    if (single) {
        blockSize = Math.max(1, (int) gd.getNextNumber());
        randomSplit = gd.getNextBoolean();
        repeats = Math.max(1, (int) gd.getNextNumber());
        showFRCCurveRepeats = gd.getNextBoolean();
        showFRCTimeEvolution = gd.getNextBoolean();
        spuriousCorrelationCorrection = gd.getNextBoolean();
        qValue = Math.abs(gd.getNextNumber());
        mean = Math.abs(gd.getNextNumber());
        sigma = Math.abs(gd.getNextNumber());
        if (extraOptions) {
            setThreads((int) gd.getNextNumber());
            lastNThreads = this.nThreads;
        }
    }
    // Check arguments
    try {
        Parameters.isAboveZero("Perimeter sampling factor", perimeterSamplingFactor);
        if (single && spuriousCorrelationCorrection) {
            Parameters.isAboveZero("Q-value", qValue);
            Parameters.isAboveZero("Precision Mean", mean);
            Parameters.isAboveZero("Precision Sigma", sigma);
            // Set these for use in FIRE computation 
            setCorrectionParameters(qValue, mean, sigma);
        }
    } catch (IllegalArgumentException e) {
        IJ.error(TITLE, e.getMessage());
        return false;
    }
    return true;
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) GridBagLayout(java.awt.GridBagLayout) Color(java.awt.Color) Label(java.awt.Label) NonBlockingExtendedGenericDialog(ij.gui.NonBlockingExtendedGenericDialog) ExtendedGenericDialog(ij.gui.ExtendedGenericDialog) Component(java.awt.Component) WeightedObservedPoint(org.apache.commons.math3.fitting.WeightedObservedPoint)

Example 5 with Label

use of java.awt.Label in project GDSC-SMLM by aherbert.

the class LoadLocalisations method getFields.

private static boolean getFields() {
    GenericDialog gd = new GenericDialog(TITLE);
    gd.addMessage("Load delimited localisations");
    gd.addStringField("Dataset_name", name, 30);
    gd.addMessage("Calibration:");
    gd.addNumericField("Pixel_size", pixelPitch, 3, 8, "nm");
    gd.addNumericField("Gain", gain, 3, 8, "Count/photon");
    gd.addNumericField("Exposure_time", exposureTime, 3, 8, "ms");
    gd.addMessage("Records:");
    gd.addNumericField("Header_lines", header, 0);
    gd.addStringField("Comment", comment);
    gd.addStringField("Delimiter", delimiter);
    String[] dUnits = SettingsManager.getNames((Object[]) DistanceUnit.values());
    gd.addChoice("Distance_unit", dUnits, dUnits[distanceUnit]);
    String[] iUnits = SettingsManager.getNames((Object[]) IntensityUnit.values());
    gd.addChoice("Intensity_unit", iUnits, iUnits[intensityUnit]);
    gd.addMessage("Define the fields:");
    Label l = (Label) gd.getMessage();
    gd.addNumericField("T", it, 0);
    gd.addNumericField("ID", iid, 0);
    gd.addNumericField("X", ix, 0);
    gd.addNumericField("Y", iy, 0);
    gd.addNumericField("Z", iz, 0);
    gd.addNumericField("Intensity", ii, 0);
    gd.addNumericField("Sx", isx, 0);
    gd.addNumericField("Sy", isy, 0);
    gd.addNumericField("Precision", ip, 0);
    // Rearrange
    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 == l) {
                xOffset += 2;
                // Skip title row
                yOffset = yOffset - rowCount + 1;
            }
            // 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;
    }
    name = getNextString(gd, name);
    pixelPitch = gd.getNextNumber();
    gain = gd.getNextNumber();
    exposureTime = gd.getNextNumber();
    header = (int) gd.getNextNumber();
    comment = gd.getNextString();
    delimiter = getNextString(gd, delimiter);
    distanceUnit = gd.getNextChoiceIndex();
    intensityUnit = gd.getNextChoiceIndex();
    int[] columns = new int[9];
    for (int i = 0; i < columns.length; i++) columns[i] = (int) gd.getNextNumber();
    {
        int i = 0;
        it = columns[i++];
        iid = columns[i++];
        ix = columns[i++];
        iy = columns[i++];
        iz = columns[i++];
        ii = columns[i++];
        isx = columns[i++];
        isy = columns[i++];
        ip = columns[i++];
    }
    if (gd.invalidNumber()) {
        IJ.error(TITLE, "Invalid number in input fields");
        return false;
    }
    for (int i = 0; i < columns.length; i++) {
        if (columns[i] < 0)
            continue;
        for (int j = i + 1; j < columns.length; j++) {
            if (columns[j] < 0)
                continue;
            if (columns[i] == columns[j]) {
                IJ.error(TITLE, "Duplicate indicies: " + columns[i]);
                return false;
            }
        }
    }
    if (gain <= 0 || pixelPitch <= 0) {
        IJ.error(TITLE, "Require positive gain and pixel pitch");
        return false;
    }
    if (ix < 0 || iy < 0) {
        IJ.error(TITLE, "Require valid X and Y indices");
        return false;
    }
    return true;
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) GridBagLayout(java.awt.GridBagLayout) GenericDialog(ij.gui.GenericDialog) Color(java.awt.Color) Label(java.awt.Label) Component(java.awt.Component)

Aggregations

Label (java.awt.Label)52 Panel (java.awt.Panel)26 TextField (java.awt.TextField)18 Button (java.awt.Button)17 GridBagConstraints (java.awt.GridBagConstraints)17 JPanel (javax.swing.JPanel)17 GridBagLayout (java.awt.GridBagLayout)16 BorderLayout (java.awt.BorderLayout)15 Choice (java.awt.Choice)12 Dimension (java.awt.Dimension)10 Checkbox (java.awt.Checkbox)9 Component (java.awt.Component)9 JLabel (javax.swing.JLabel)8 Insets (java.awt.Insets)7 ArrayList (java.util.ArrayList)7 Color (java.awt.Color)6 ActionEvent (java.awt.event.ActionEvent)6 FlowLayout (java.awt.FlowLayout)5 ItemListener (java.awt.event.ItemListener)5 JButton (javax.swing.JButton)5