Example usage for javax.swing JCheckBox isSelected

List of usage examples for javax.swing JCheckBox isSelected

Introduction

In this page you can find the example usage for javax.swing JCheckBox isSelected.

Prototype

public boolean isSelected() 

Source Link

Document

Returns the state of the button.

Usage

From source file:org.ut.biolab.medsavant.client.query.view.NumberSearchConditionEditorView.java

@Override
public void loadViewFromSearchConditionParameters(String encoding) throws ConditionRestorationException {

    double[] selectedValues;
    if (encoding == null) {
        selectedValues = null;/*from   www .  ja v a  2s.  co m*/
    } else {
        selectedValues = NumericConditionEncoder.unencodeConditions(encoding);
    }

    final double[] extremeValues = generator.getExtremeNumericValues();
    this.removeAll();

    if (extremeValues == null || (extremeValues[0] == 0 && extremeValues[1] == 0)) {
        JPanel p = new JPanel();
        p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
        p.add(Box.createHorizontalGlue());
        p.add(new JLabel("<html>All values are blank for this condition.</html>"));
        p.add(Box.createHorizontalGlue());
        this.add(p);
        return;
    }

    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    JPanel p = ViewUtil.getClearPanel();
    ViewUtil.applyVerticalBoxLayout(p);

    JPanel labelPanel = ViewUtil.getClearPanel();
    ViewUtil.applyHorizontalBoxLayout(labelPanel);
    labelPanel.add(Box.createHorizontalGlue());
    labelPanel.add(new JLabel("Filtering variants where " + item.getName() + ": "));
    labelPanel.add(Box.createHorizontalGlue());
    ButtonGroup group = new ButtonGroup();
    //JRadioButton isButton = new JRadioButton("is within the following range:");
    //JRadioButton nullButton = new JRadioButton("is missing");
    //group.add(isButton);
    //group.add(nullButton);

    final JCheckBox nullButton = new JCheckBox("include missing values");

    JPanel bp = ViewUtil.getClearPanel();
    ViewUtil.applyHorizontalBoxLayout(bp);
    p.add(labelPanel);
    p.add(bp);
    add(p);
    final DecimalRangeSlider slider = new DecimalRangeSlider();

    slider.setMajorTickSpacing(5);
    slider.setMinorTickSpacing(1);

    final JTextField fromBox = new JTextField();
    final JTextField toBox = new JTextField();

    nullButton.setSelected(NumericConditionEncoder.encodesNull(encoding));

    nullButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            encodeValue(ViewUtil.parseDoubleFromFormattedString(fromBox.getText()),
                    ViewUtil.parseDoubleFromFormattedString(toBox.getText()), extremeValues[0],
                    extremeValues[1], nullButton.isSelected());
        }
    });

    fromBox.setMaximumSize(new Dimension(10000, 24));
    toBox.setMaximumSize(new Dimension(10000, 24));
    fromBox.setPreferredSize(new Dimension(FROM_TO_WIDTH, 24));
    toBox.setPreferredSize(new Dimension(FROM_TO_WIDTH, 24));
    fromBox.setMinimumSize(new Dimension(FROM_TO_WIDTH, 24));
    toBox.setMinimumSize(new Dimension(FROM_TO_WIDTH, 24));
    fromBox.setHorizontalAlignment(JTextField.RIGHT);
    toBox.setHorizontalAlignment(JTextField.RIGHT);

    final JLabel fromLabel = new JLabel();
    final JLabel toLabel = new JLabel();

    ViewUtil.makeMini(fromLabel);
    ViewUtil.makeMini(toLabel);

    JPanel fromToContainer = ViewUtil.getClearPanel();
    ViewUtil.applyHorizontalBoxLayout(fromToContainer);
    fromToContainer.add(Box.createHorizontalGlue());
    fromToContainer.add(fromBox);
    fromToContainer.add(new JLabel(" - "));
    fromToContainer.add(toBox);
    fromToContainer.add(Box.createHorizontalGlue());

    JPanel minMaxContainer = ViewUtil.getClearPanel();
    minMaxContainer.setLayout(new BoxLayout(minMaxContainer, BoxLayout.X_AXIS));

    JPanel sliderContainer = ViewUtil.getClearPanel();
    sliderContainer.setLayout(new BoxLayout(sliderContainer, BoxLayout.Y_AXIS));
    sliderContainer.add(slider);

    JPanel nullValueContainer = ViewUtil.getClearPanel();
    ViewUtil.applyHorizontalBoxLayout(nullValueContainer);
    nullValueContainer.add(Box.createHorizontalGlue());
    nullValueContainer.add(nullButton);
    nullButton.setBackground(nullValueContainer.getBackground()); //fixes a windows issue.
    nullValueContainer.add(Box.createHorizontalGlue());

    JPanel labelContainer = ViewUtil.getClearPanel();
    labelContainer.setLayout(new BoxLayout(labelContainer, BoxLayout.X_AXIS));
    labelContainer.add(fromLabel);
    labelContainer.add(Box.createHorizontalGlue());
    labelContainer.add(toLabel);
    sliderContainer.add(labelContainer);
    minMaxContainer.add(Box.createHorizontalGlue());
    minMaxContainer.add(sliderContainer);
    minMaxContainer.add(Box.createHorizontalGlue());

    add(fromToContainer);
    add(minMaxContainer);
    add(nullValueContainer);
    add(Box.createVerticalBox());

    slider.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            if (slider.isEnabled()) {
                fromBox.setText(ViewUtil.numToString(slider.getLow()));
                toBox.setText(ViewUtil.numToString(slider.getHigh()));
                encodeValue(ViewUtil.parseDoubleFromFormattedString(fromBox.getText()),
                        ViewUtil.parseDoubleFromFormattedString(toBox.getText()), extremeValues[0],
                        extremeValues[1], nullButton.isSelected());
            }
        }
    });

    final KeyListener keyListener = new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            int key = e.getKeyCode();
            if (key == KeyEvent.VK_ENTER) {
                Range selectedRage = new Range(getNumber(fromBox.getText()), getNumber(toBox.getText()));
                setSelectedValues(slider, fromBox, toBox, selectedRage);
            }
        }

        private double getNumber(String s) {
            try {
                return Double.parseDouble(s.replaceAll(",", ""));
            } catch (NumberFormatException ignored) {
                return 0;
            }
        }
    };

    CaretListener caretListener = new CaretListener() {
        @Override
        public void caretUpdate(CaretEvent ce) {
            if (!isAdjustingSlider) {
                try {
                    encodeValue(ViewUtil.parseDoubleFromFormattedString(fromBox.getText()),
                            ViewUtil.parseDoubleFromFormattedString(toBox.getText()), extremeValues[0],
                            extremeValues[1], nullButton.isSelected());
                } catch (Exception e) {
                }
            }
        }
    };

    fromBox.addKeyListener(keyListener);

    toBox.addKeyListener(keyListener);

    fromBox.addCaretListener(caretListener);

    toBox.addCaretListener(caretListener);

    slider.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            isAdjustingSlider = true;
            fromBox.setText(ViewUtil.numToString(slider.getLow()));
            toBox.setText(ViewUtil.numToString(slider.getHigh()));
            isAdjustingSlider = false;
        }
    });

    JPanel bottomContainer = new JPanel();

    bottomContainer.setLayout(new BoxLayout(bottomContainer, BoxLayout.X_AXIS));

    bottomContainer.add(Box.createHorizontalGlue());

    add(bottomContainer);

    setExtremeValues(slider, fromLabel, toLabel, fromBox, toBox, 0,
            new Range(extremeValues[0], extremeValues[1]));

    if (encoding != null) {
        double[] d = NumericConditionEncoder.unencodeConditions(encoding);
        setSelectedValues(slider, fromBox, toBox, new Range(d[0], d[1]));
    }
}

From source file:org.ut.biolab.medsavant.client.variant.ImportVariantsWizard.java

private AbstractWizardPage getChooseFilesPage() {
    //setup page// w  w w. j  av a 2  s. co  m
    final DefaultWizardPage page = new DefaultWizardPage("Choose Files") {
        @Override
        public void setupWizardButtons() {
            fireButtonEvent(ButtonEvent.HIDE_BUTTON, ButtonNames.FINISH);
            fireButtonEvent(ButtonEvent.SHOW_BUTTON, ButtonNames.BACK);

            if (uploadRequired) {
                if (variantFiles != null && variantFiles.length > 0) {
                    fireButtonEvent(ButtonEvent.ENABLE_BUTTON, ButtonNames.NEXT);
                } else {
                    fireButtonEvent(ButtonEvent.DISABLE_BUTTON, ButtonNames.NEXT);
                }
            } else {
                if (serverPathField.getText().isEmpty()) {
                    fireButtonEvent(ButtonEvent.DISABLE_BUTTON, ButtonNames.NEXT);
                } else {
                    fireButtonEvent(ButtonEvent.ENABLE_BUTTON, ButtonNames.NEXT);
                }
            }
        }
    };

    chooseContainer = new JPanel();
    chooseContainer = new JPanel();
    chooseContainer.setLayout(new BorderLayout());
    chooseTitleLabel = new JLabel();
    filesOnMyComputerPanel = populateOnMyComputerPanel(page);// populateRepositoryPanel();
    filesOnMedSavantServerPanel = populateOnServerPanel(page); //populateLocalPanel();

    page.addComponent(chooseTitleLabel);
    page.addComponent(chooseContainer);

    page.addComponent(
            new JLabel("Files can be in Variant Call Format (*.vcf) or BGZipped\nVCF (*.vcf.gz).\n\n"));

    final JCheckBox homoRefBox = new JCheckBox("Include HomoRef variants (strongly discouraged)");
    homoRefBox.setOpaque(false);
    homoRefBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            includeHomoRef = homoRefBox.isSelected();
        }
    });
    page.addComponent(homoRefBox);

    setUploadRequired(true);

    return page;

}

From source file:org.ut.biolab.medsavant.client.view.dialog.SavantExportForm.java

private void export() throws InterruptedException, IOException, SQLException, RemoteException {
    try {/*  w  ww .  j  a  va2s.co m*/
        //get selected DNA IDs
        List<String> selectedIds = new ArrayList<String>();
        for (JCheckBox box : checkBoxes) {
            if (box.isSelected()) {
                selectedIds.add(box.getText());
            }
        }
        if (selectedIds.isEmpty()) {
            progressLabel.setText("No individuals selected");
            progressDialog.setVisible(false);
            this.setVisible(true);
            return;
        }

        //get bookmarks
        Map<String, List<String>> map = MedSavantClient.VariantManager.getSavantBookmarkPositionsForDNAIDs(
                LoginController.getSessionID(), ProjectController.getInstance().getCurrentProjectID(),
                ReferenceController.getInstance().getCurrentReferenceID(),
                FilterController.getInstance().getAllFilterConditions(), selectedIds, -1);

        //get BAM files
        Collection<String> bamFiles = MedSavantClient.PatientManager.getValuesFromDNAIDs(
                LoginController.getSessionID(), ProjectController.getInstance().getCurrentProjectID(),
                BasicPatientColumns.BAM_URL.getColumnName(), selectedIds).values();

        //genome version
        String genomeName = ReferenceController.getInstance().getCurrentReferenceName();
        String genomeUrl = ReferenceController.getInstance().getCurrentReferenceUrl();

        //create file
        BufferedWriter out = new BufferedWriter(new FileWriter(outputFile));

        out.write("<?xml version=\"1.0\" ?>\n" + "<savant version=\"1\" range=\"chr1:1-1000\">\n");

        if (genomeUrl != null) {
            out.write(" <genome name=\"" + genomeName + "\" uri=\"" + genomeUrl + "\" />\n");
        } else {
            out.write(" <genome name=\"" + genomeName + "\" >\n");
            for (Chromosome c : ReferenceController.getInstance().getChromosomes()) {
                out.write("   <reference name=\"" + c.getName() + "\" length=\"" + c.getLength() + "\" />\n");
            }
            out.write(" </genome>\n");
        }

        for (String path : bamFiles) {
            out.write("  <track uri=\"" + path + "\"/>\n");
        }

        Object[] keys = map.keySet().toArray();
        for (Object keyObject : keys) {
            String key = (String) keyObject;
            List<String> positions = map.get(key);
            for (String p : positions) {
                out.write("  <bookmark range=\"" + p + "\">" + key + "</bookmark>\n");
            }
        }

        out.write("</savant>\n");

        //out.write(s);
        out.close();

        progressDialog.setVisible(false);
        setVisible(false);
        progressDialog.dispose();
        dispose();
    } catch (SessionExpiredException ex) {
        MedSavantExceptionHandler.handleSessionExpiredException(ex);
        return;
    }
}

From source file:org.yccheok.jstock.gui.NewBrokingFirmJDialog.java

private void jCheckBox1ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jCheckBox1ItemStateChanged
    JCheckBox me = (JCheckBox) evt.getSource();

    if (me.isSelected() && (this.logo == null)) {
        this.letUserSelectAnImage();
        if (this.logo == null) {
            this.jCheckBox1.setSelected(false);
        }/*from w ww. j  a  va 2 s.  c  o  m*/
    }
}

From source file:org.yccheok.jstock.gui.StockJDialog.java

public java.util.List<StockInfo> buildSelectedStockInfos() {
    java.util.List<StockInfo> selectedStockInfos = new java.util.ArrayList<StockInfo>();

    JStock m = JStock.instance();//from ww  w  .ja  v  a  2 s .c  o  m

    StockInfoDatabase stock_info_database = m.getStockInfoDatabase();
    if (stock_info_database == null) {
        log.error("Unable to locate MainFrame");
        return null;
    }

    if (jRadioButton2.isSelected()) {
        selectedStockInfos.addAll(stock_info_database.getStockInfos());
        return selectedStockInfos;
    }

    if (jRadioButton3.isSelected()) {
        for (JCheckBox checkBox : boardCheckBoxes) {
            if (checkBox.isSelected() == false)
                continue;

            final Board board = this.checkBoxToBoard.get(checkBox);

            if (board == null) {
                log.error("Wrong text in JCheckBox GUI : " + checkBox.getText());
                continue;
            }

            selectedStockInfos.addAll(stock_info_database.getStockInfos(board));
        }

        return selectedStockInfos;
    }

    if (jRadioButton4.isSelected()) {
        for (JCheckBox checkBox : industryCheckBoxes) {
            if (checkBox.isSelected() == false)
                continue;

            final Industry industry = this.checkBoxToIndustry.get(checkBox);

            if (industry == null) {
                log.error("Wrong text in JCheckBox GUI : " + checkBox.getText());
                continue;
            }

            selectedStockInfos.addAll(stock_info_database.getStockInfos(industry));
        }

        return selectedStockInfos;
    }

    return null;
}

From source file:org.yccheok.jstock.gui.WizardSelectStockJPanel.java

public boolean isNextFinishButtonEnabled() {
    if (jRadioButton1.isSelected()) {
        return true;
    }//from   w w w  .  j  a  v a 2  s  . co  m

    if (jRadioButton2.isSelected()) {
        for (JCheckBox checkBox : boardCheckBoxes) {
            if (checkBox.isSelected())
                return true;
        }
    }

    if (jRadioButton3.isSelected()) {
        for (JCheckBox checkBox : industryCheckBoxes) {
            if (checkBox.isSelected())
                return true;
        }
    }

    if (jRadioButton4.isSelected())
        return true;

    return false;
}

From source file:org.yccheok.jstock.gui.WizardSelectStockJPanel.java

public boolean buildSelectedStockCodes() {
    selectedStockInfos.clear();/*  w ww  .  j  a  v a2s .c  om*/

    JStock m = JStock.instance();
    StockInfoDatabase stock_info_database = m.getStockInfoDatabase();
    if (stock_info_database == null) {
        log.error("Unable to locate MainFrame");
        return false;
    }

    if (jRadioButton1.isSelected()) {
        selectedStockInfos.addAll(stock_info_database.getStockInfos());
        return true;
    }

    if (jRadioButton2.isSelected()) {
        for (JCheckBox checkBox : boardCheckBoxes) {
            if (checkBox.isSelected() == false)
                continue;

            final Board board = this.checkBoxToBoard.get(checkBox);

            if (board == null) {
                log.error("Wrong text in JCheckBox GUI : " + checkBox.getText());
                continue;
            }

            selectedStockInfos.addAll(stock_info_database.getStockInfos(board));
        }

        return true;
    }

    if (jRadioButton3.isSelected()) {
        for (JCheckBox checkBox : industryCheckBoxes) {
            if (checkBox.isSelected() == false)
                continue;

            final Industry industry = this.checkBoxToIndustry.get(checkBox);

            if (industry == null) {
                log.error("Wrong text in JCheckBox GUI : " + checkBox.getText());
                continue;
            }

            selectedStockInfos.addAll(stock_info_database.getStockInfos(industry));
        }

        return true;
    }

    if (jRadioButton4.isSelected()) {
        java.util.List<Stock> stocks = m.getStocks();
        for (Stock stock : stocks) {
            selectedStockInfos.add(StockInfo.newInstance(stock));
        }

        return true;
    }

    return false;
}

From source file:org.zaproxy.zap.extension.autoupdate.ExtensionAutoUpdate.java

private void alertIfOutOfDate(boolean alwaysPrompt) {
    final OptionsParamCheckForUpdates options = getModel().getOptionsParam().getCheckForUpdatesParam();
    Date today = new Date();
    Date releaseCreated = Constant.getReleaseCreateDate();
    Date lastInstallWarning = options.getDayLastInstallWarned();
    int result = -1;
    logger.debug("Install created " + releaseCreated);
    if (releaseCreated != null) {
        // Should only be null for dev builds
        int daysOld = dayDiff(today, releaseCreated);
        logger.debug("Install is " + daysOld + " days old");
        if (daysOld > 365) {
            // Oh no, its more than a year old!
            boolean setCfuOnStart = false;

            if (alwaysPrompt || lastInstallWarning == null || dayDiff(today, lastInstallWarning) > 30) {
                JCheckBox cfuOnStart = new JCheckBox(Constant.messages.getString("cfu.label.cfuonstart"));
                cfuOnStart.setSelected(true);
                String msg = Constant.messages.getString("cfu.label.oldzap");

                result = View.getSingleton().showYesNoDialog(View.getSingleton().getMainFrame(),
                        new Object[] { msg, cfuOnStart });
                setCfuOnStart = cfuOnStart.isSelected();

            }//from   w  w w. j av  a2 s  . c o m
            options.setDayLastInstallWarned();

            if (result == JOptionPane.OK_OPTION) {
                if (setCfuOnStart) {
                    options.setCheckOnStart(true);
                }
                getAddOnsDialog().setVisible(true);
                getAddOnsDialog().checkForUpdates();

            } else if (!oldZapAlertAdded) {
                JButton button = new JButton(Constant.messages.getString("cfu.label.outofdatezap"));
                button.setIcon(
                        new ImageIcon(ExtensionAutoUpdate.class.getResource("/resource/icon/16/050.png"))); // Alert triangle
                button.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        alertIfOutOfDate(true);
                    }
                });

                View.getSingleton().getMainFrame().getMainFooterPanel().addFooterToolbarLeftComponent(button);
                oldZapAlertAdded = true;
            }
            return;
        }
    }

    Date lastChecked = options.getDayLastChecked();
    Date lastUpdateWarning = options.getDayLastUpdateWarned();
    Date installDate = Constant.getInstallDate();
    if (installDate == null || dayDiff(today, installDate) < 90) {
        // Dont warn if installed in the last 3 months
    } else if (lastChecked == null || dayDiff(today, lastChecked) > 90) {
        // Not checked for updates in 3 months :(
        boolean setCfuOnStart = false;

        if (alwaysPrompt || lastUpdateWarning == null || dayDiff(today, lastUpdateWarning) > 30) {
            JCheckBox cfuOnStart = new JCheckBox(Constant.messages.getString("cfu.label.cfuonstart"));
            cfuOnStart.setSelected(true);
            String msg = Constant.messages.getString("cfu.label.norecentcfu");

            result = View.getSingleton().showYesNoDialog(View.getSingleton().getMainFrame(),
                    new Object[] { msg, cfuOnStart });
            setCfuOnStart = cfuOnStart.isSelected();

        }
        options.setDayLastUpdateWarned();

        if (result == JOptionPane.OK_OPTION) {
            if (setCfuOnStart) {
                options.setCheckOnStart(true);
            }
            getAddOnsDialog().setVisible(true);
            getAddOnsDialog().checkForUpdates();
            if (noCfuAlertAdded) {
                View.getSingleton().getMainFrame().getMainFooterPanel()
                        .removeFooterToolbarLeftComponent(getOutOfDateButton());
            }

        } else if (!noCfuAlertAdded) {
            View.getSingleton().getMainFrame().getMainFooterPanel()
                    .addFooterToolbarLeftComponent(getOutOfDateButton());
            noCfuAlertAdded = true;
        }
    }
}

From source file:org.zaproxy.zap.extension.cmss.CMSSFrame.java

/** Create the frame. */
public CMSSFrame() {
    setTitle("Fingerprinting tools");
    setResizable(false);/* w w w. j a v  a2 s .  c o  m*/
    setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    setBounds(100, 100, 756, 372);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    contentPane.setLayout(new BorderLayout(0, 0));
    setContentPane(contentPane);

    JLayeredPane layeredPane = new JLayeredPane();
    contentPane.add(layeredPane, BorderLayout.CENTER);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setBounds(0, 0, 725, 323);
    layeredPane.add(tabbedPane);

    JLayeredPane layeredPane_1 = new JLayeredPane();
    tabbedPane.addTab("Fingerprint", null, layeredPane_1, null);

    JLabel label = new JLabel("App name:");
    label.setBounds(35, 188, 76, 14);
    layeredPane_1.add(label);

    JLabel label_1 = new JLabel("Version:");
    label_1.setBounds(35, 230, 76, 14);
    layeredPane_1.add(label_1);

    textField = new JTextField();
    textField.setColumns(10);
    textField.setBounds(121, 188, 109, 29);
    layeredPane_1.add(textField);

    textField_1 = new JTextField();
    textField_1.setColumns(10);
    textField_1.setBounds(121, 223, 109, 29);
    layeredPane_1.add(textField_1);

    JSeparator separator = new JSeparator();
    separator.setBounds(35, 72, 665, 2);
    layeredPane_1.add(separator);

    JSeparator separator_1 = new JSeparator();
    separator_1.setBounds(196, 11, 1, 201);
    layeredPane_1.add(separator_1);

    JSeparator separator_2 = new JSeparator();
    separator_2.setOrientation(SwingConstants.VERTICAL);
    separator_2.setBounds(260, 81, 1, 201);
    layeredPane_1.add(separator_2);

    final JCheckBox chckbxGetVersion = new JCheckBox("Get version");
    chckbxGetVersion.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            if (textField_1.isEnabled() && !chckbxGetVersion.isSelected())
                textField_1.setEnabled(false);
            if (!textField_1.isEnabled() && chckbxGetVersion.isSelected())
                textField_1.setEnabled(true);
        }
    });
    chckbxGetVersion.setBounds(35, 81, 195, 23);
    layeredPane_1.add(chckbxGetVersion);

    final JCheckBox chckbxPassiveFingerprinting = new JCheckBox("Passive");
    chckbxPassiveFingerprinting.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
        }
    });
    chckbxPassiveFingerprinting.setBounds(35, 107, 195, 23);
    chckbxPassiveFingerprinting.setSelected(true); //
    layeredPane_1.add(chckbxPassiveFingerprinting);

    final JCheckBox chckbxAgressive = new JCheckBox("Agressive");
    chckbxAgressive.setBounds(35, 133, 195, 23);
    layeredPane_1.add(chckbxAgressive);

    JLabel lblWhatToFingerprint = new JLabel("What to fingerprint ?");
    lblWhatToFingerprint.setBounds(287, 81, 109, 14);
    layeredPane_1.add(lblWhatToFingerprint);

    JCheckBox chckbxCms = new JCheckBox("cms");
    chckbxCms.setBounds(280, 102, 134, 23);
    layeredPane_1.add(chckbxCms);

    JCheckBox chckbxMessageboards = new JCheckBox("message-boards");
    chckbxMessageboards.setBounds(280, 128, 134, 23);
    layeredPane_1.add(chckbxMessageboards);

    JCheckBox chckbxJavascriptframeworks = new JCheckBox("javascript-frameworks");
    chckbxJavascriptframeworks.setBounds(281, 154, 133, 23);
    layeredPane_1.add(chckbxJavascriptframeworks);

    JCheckBox chckbxWebframeworks = new JCheckBox("web-frameworks");
    chckbxWebframeworks.setBounds(281, 178, 133, 23);
    layeredPane_1.add(chckbxWebframeworks);

    JCheckBox chckbxWebservers = new JCheckBox("web-servers");
    chckbxWebservers.setBounds(281, 204, 133, 23);
    layeredPane_1.add(chckbxWebservers);

    JSeparator separator_4 = new JSeparator();
    separator_4.setOrientation(SwingConstants.VERTICAL);
    separator_4.setBounds(435, 81, 1, 201);
    layeredPane_1.add(separator_4);

    JCheckBox chckbxDatabases = new JCheckBox("databases");
    chckbxDatabases.setBounds(281, 228, 133, 23);
    layeredPane_1.add(chckbxDatabases);

    JButton btnMore = new JButton("More");
    btnMore.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            wtfpFrame = new WhatToFingerPrintFrame();
            wtfpFrame.setLocationRelativeTo(null);
            wtfpFrame.setVisible(true);
        }
    });
    btnMore.setBounds(291, 261, 123, 23);
    layeredPane_1.add(btnMore);

    JLabel lblFingerprintingTimeAnd = new JLabel("Fingerprinting time and occuracy settings:");
    lblFingerprintingTimeAnd.setBounds(490, 81, 210, 14);
    layeredPane_1.add(lblFingerprintingTimeAnd);

    JButton btnFingerprint = new JButton("Fingerprint");
    btnFingerprint.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (!chckbxPassiveFingerprinting.isSelected() && !chckbxAgressive.isSelected())
                chckbxPassiveFingerprinting.setSelected(true);
            if (chckbxPassiveFingerprinting.isSelected() && !chckbxAgressive.isSelected())
                POrAOption = 1;
            else if (!chckbxPassiveFingerprinting.isSelected() && chckbxAgressive.isSelected())
                POrAOption = 2;
            else if (chckbxPassiveFingerprinting.isSelected() && chckbxAgressive.isSelected())
                POrAOption = 3;

            try {
                targetUrl = new URL(txtHttp.getText());
            } catch (MalformedURLException e2) {
                // TODO Auto-generated catch block
                e2.printStackTrace();
            }

            System.out.println("POrAOption : " + POrAOption);

            // we concatenate the two ArrayLists
            ArrayList<String> wtfpList = getWhatToFingerprint();
            for (String wtfp : wtfpFrame.getWhatToFingerprint()) {
                wtfpList.add(wtfp);
            }
            // we call FastFingerprinter.filterResults on the global whatToFingerPrint
            // List

            fpThread = new FingerPrintingThread(targetUrl, wtfpList, POrAOption);
            fpThread.start();
            while (fpThread.isAlive()) {
                // waiting;

            }
            ArrayList<String> resultList = fpThread.getFingerPrintingResult();
            for (String app : resultList) {
                textField.setText(textField.getText() + app + " , ");
            }

            if (chckbxGetVersion.isSelected()) {
                System.out.println("wiw");
                ArrayList<String> versions = new ArrayList<String>();

                if (resultList.contains("wordpress")) {
                    textField_1.setText(textField_1.getText() + "wordpress :");
                    for (String version : FastFingerprinter.WordpressFastFingerprint(targetUrl)) {
                        textField_1.setText(textField_1.getText() + version + " ; ");
                    }
                }

                if (resultList.contains("joomla")) {
                    textField_1.setText(textField_1.getText() + "joomla :");
                    for (String version : FastFingerprinter.JoomlaFastFingerprint(targetUrl)) {
                        textField_1.setText(textField_1.getText() + version + " ; ");
                    }
                }

                // blindelephant
                for (String app : resultList) {
                    System.out.println("---->" + app);
                    try {
                        versions = WebAppGuesser.fingerPrintFile(app);
                        textField_1.setText(textField_1.getText() + app + " : ");
                        for (String version : versions) {
                            textField_1.setText(textField_1.getText() + version + " ; ");
                        }
                    } catch (NoSuchAlgorithmException | IOException | DecoderException e1) {
                        e1.printStackTrace();
                    }
                }
            }
        }
    });

    btnFingerprint.setBounds(35, 154, 195, 23);
    layeredPane_1.add(btnFingerprint);

    JButton btnDetailedView = new JButton("Detailed view ");
    btnDetailedView.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
        }
    });
    btnDetailedView.setBounds(35, 259, 195, 23);
    layeredPane_1.add(btnDetailedView);
    this.checkBoxesList.add(chckbxCms);
    this.checkBoxesList.add(chckbxJavascriptframeworks);
    this.checkBoxesList.add(chckbxWebframeworks);
    this.checkBoxesList.add(chckbxWebservers);
    this.checkBoxesList.add(chckbxDatabases);
    this.checkBoxesList.add(chckbxMessageboards);

    txtHttp = new JTextField();
    txtHttp.setText("http://");
    txtHttp.setBounds(128, 22, 568, 29);
    layeredPane_1.add(txtHttp);
    txtHttp.setColumns(10);

    JLabel lblTarget = new JLabel("Target : ");
    lblTarget.setBounds(51, 29, 46, 14);
    layeredPane_1.add(lblTarget);

    JLayeredPane layeredPane_2 = new JLayeredPane();
    tabbedPane.addTab("Details", null, layeredPane_2, null);

    JTabbedPane tabbedPane_1 = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane_1.setBounds(0, 0, 720, 223);
    layeredPane_2.add(tabbedPane_1);

    JLayeredPane layeredPane_4 = new JLayeredPane();
    tabbedPane_1.addTab("Detailed result", null, layeredPane_4, null);

    JLayeredPane layeredPane_3 = new JLayeredPane();
    tabbedPane_1.addTab("Passive fingerprint", null, layeredPane_3, null);

    JTabbedPane tabbedPane_2 = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane_1.addTab("Agressive fingerprint", null, tabbedPane_2, null);
}

From source file:org.zaproxy.zap.extension.cmss.CMSSFrame.java

private ArrayList<String> getWhatToFingerprint() {
    ArrayList<String> WhatToFingerprint = new ArrayList<String>();
    for (JCheckBox checkBox : checkBoxesList) {
        if (checkBox.isSelected()) {
            System.out.println("check boxe : " + checkBox.getText());
            WhatToFingerprint.add(checkBox.getText());
        }/*ww  w  .j ava2  s  .  c  om*/
    }
    return WhatToFingerprint;
}