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:com.github.alexfalappa.nbspringboot.projects.initializr.BootDependenciesPanel.java

public String getSelectedDependenciesString() {
    StringBuilder sb = new StringBuilder();
    for (List<JCheckBox> chList : chkBoxesMap.values()) {
        for (JCheckBox cb : chList) {
            if (cb.isEnabled() && cb.isSelected()) {
                sb.append(cb.getName()).append(',');
            }//from w  w w. jav a 2s. c om
        }
    }
    // remove last comma (if present)
    if (sb.length() > 0) {
        sb.setLength(sb.length() - 1);
    }
    return sb.toString();
}

From source file:de.mprengemann.intellij.plugin.androidicons.forms.MaterialIconsImporter.java

private ImageInformation getImageInformation(ImageInformation baseInformation, Resolution resolution,
        JCheckBox checkBox) {
    if (!checkBox.isSelected()) {
        return null;
    }// w  w  w  . j  av  a2  s.  c  o  m

    String assetCategory = (String) categorySpinner.getSelectedItem();
    String assetName = (String) assetSpinner.getSelectedItem();
    String assetColor = (String) colorSpinner.getSelectedItem();
    String assetSize = (String) sizeSpinner.getSelectedItem();
    String fromName = "ic_" + assetName + "_" + assetColor + "_" + assetSize + ".png";

    File source = new File(assetRoot.getCanonicalPath(),
            assetCategory + "/drawable-" + resolution.toString() + "/" + fromName);

    return ImageInformation.newBuilder(baseInformation).setImageFile(source).setResolution(resolution)
            .build(project);
}

From source file:com.adito.upgrade.GUIUpgrader.java

public void upgrade() throws Exception {
    if (JOptionPane.showConfirmDialog(this,
            "All selected resources will be now upgrade from the source installation to the target. Are you sure you wish to continue?",
            "Run Upgrade", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {
        ////  w w w  . j  a v  a 2 s.c om
        final List l = new ArrayList();
        for (int i = 0; i < upgradeSelectionPanel.getComponentCount(); i++) {
            JCheckBox b = (JCheckBox) upgradeSelectionPanel.getComponent(i);
            if (b.isSelected()) {
                l.add(b.getClientProperty("upgrade"));
            }
        }

        removeUpgradeSelectionComponent();
        invalidate();
        removeAll();

        // Progress panel
        JPanel progressPanel = new JPanel(new BorderLayout());
        progressPanel.setBorder(BorderFactory.createTitledBorder("Progress"));
        final JProgressBar b = new JProgressBar(0, l.size());
        b.setStringPainted(true);
        progressPanel.add(b, BorderLayout.CENTER);
        add(progressPanel, BorderLayout.NORTH);

        // Console panel
        JPanel consolePanel = new JPanel(new BorderLayout());
        consolePanel.setBorder(BorderFactory.createTitledBorder("Output"));
        console = new JTextPane();
        JScrollPane scrollPane = new JScrollPane(console);
        consolePanel.add(scrollPane, BorderLayout.CENTER);
        add(consolePanel, BorderLayout.CENTER);

        //

        validate();
        repaint();

        //

        Thread t = new Thread() {
            public void run() {
                try {
                    for (Iterator i = l.iterator(); i.hasNext();) {
                        AbstractDatabaseUpgrade upgrade = (AbstractDatabaseUpgrade) i.next();
                        b.setValue(b.getValue() + 1);
                        upgrade.upgrade(GUIUpgrader.this);
                        try {
                            Thread.sleep(750);
                        } catch (InterruptedException ie) {
                        }
                    }
                    info("Complete");
                    Toolkit.getDefaultToolkit().beep();
                } catch (Exception e) {
                    error("Failed to upgrade.", e);
                }
            }
        };
        t.start();

    }

}

From source file:edu.ku.brc.helpers.EMailHelper.java

/**
 * Asks for a password./* ww  w .  jav a2  s  .  com*/
 * @param topframe the parent frame
 * @return the password
 */
public static String askForPassword(final Frame topframe) {
    PanelBuilder builder = new PanelBuilder(new FormLayout("p,2px,p", "p,2px,p")); //$NON-NLS-1$ //$NON-NLS-2$
    CellConstraints cc = new CellConstraints();
    JLabel label = createI18NFormLabel("EMailHelper.PASSWORD"); //$NON-NLS-1$ //$NON-NLS-2$
    JPasswordField passField = createPasswordField(25);
    JCheckBox savePassword = createCheckBox(getResourceString("EMailHelper.SAVE_PASSWORD")); //$NON-NLS-1$

    builder.add(label, cc.xy(1, 1));
    builder.add(passField, cc.xy(3, 1));
    builder.add(savePassword, cc.xy(3, 3));
    JOptionPane.showConfirmDialog(topframe, builder.getPanel(), getResourceString("EMailHelper.PASSWORD_TITLE"), //$NON-NLS-1$
            JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);

    String passwordText = new String(passField.getPassword());
    if (savePassword.isSelected()) {
        AppPreferences appPrefs = AppPreferences.getRemote();
        if (StringUtils.isNotEmpty(passwordText)) {
            appPrefs.put("settings.email.password", Encryption.encrypt(passwordText)); //$NON-NLS-1$
        }
    }

    return passwordText;
}

From source file:de.mycrobase.jcloudapp.Main.java

private static Map<String, String> showLoginDialog() {
    String message = ""; //"Welcome to JCloudApp!";

    JTextField usernameField = new JTextField();
    JPasswordField passwordField = new JPasswordField();
    JCheckBox remeberCheck = new JCheckBox("Remember login (on disk)");
    remeberCheck.setSelected(true);//from   ww  w.jav a2s .c o  m
    Object[] content = { message, "Username:", usernameField, "Password:", passwordField, remeberCheck };

    //        int res = JOptionPane.showOptionDialog(
    //            null, content, "JCloudApp - Login",
    //            JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, icon,
    //            null, usernameField);
    int res = JOptionPane.showConfirmDialog(null, content, "JCloudApp - Login", JOptionPane.OK_CANCEL_OPTION,
            JOptionPane.QUESTION_MESSAGE, IconLarge);

    if (res == JOptionPane.OK_OPTION) {
        HashMap<String, String> m = new HashMap<String, String>();
        m.put("username", usernameField.getText());
        m.put("password", new String(passwordField.getPassword()));
        m.put("remember", Boolean.toString(remeberCheck.isSelected()));
        return m;
    } else {
        return null;
    }
}

From source file:com.konifar.material_icon_generator.MaterialDesignIconGenerateDialog.java

private boolean alreadyFileExists() {
    JCheckBox[] checkBoxes = { checkBoxMdpi, checkBoxHdpi, checkBoxXhdpi, checkBoxXxhdpi, checkBoxXxxhdpi };

    for (JCheckBox checkBox : checkBoxes) {
        if (checkBox.isSelected()) {
            File copyFile = new File(model.getCopyPath(project, checkBox.getText()));
            if (copyFile.exists() && copyFile.isFile()) {
                return true;
            }/*w ww . j  a v a  2s.  c  o m*/
        }
    }
    return false;
}

From source file:utilities.GraphViewer.java

public void actionPerformed(ActionEvent e) {
    // Evenement button parcourir
    if (e.getSource() == this.parcourir) {

        JFileChooser fileopen = new JFileChooser();
        FiltreSimple filter = new FiltreSimple("Fichier res", "res");
        fileopen.addChoosableFileFilter(filter);
        int ret = fileopen.showDialog(null, "Open file");
        if (ret == JFileChooser.APPROVE_OPTION) {
            File file = fileopen.getSelectedFile();
            System.out.println(file.getPath());
            this.addSensor(file.getPath());

        }//  w ww .j ava  2s .c o m

    } else {

        JCheckBox check;
        for (int i = 0; i < this.sensors.size(); i++) {
            check = sensors.get(i);
            if (e.getSource() == check) {
                if (check.isSelected()) {
                    if (!this.isExist(check)) {
                        String s = check.getText();
                        s = s.substring(1);
                        ajouterFichier(this.db.getPath(check.getText()));
                        sensors1.addLast(check);
                        this.graphe.revalidate();
                    }

                } else {
                    this.removeSerie(check.getText());
                    sensors1.remove(check);
                    this.graphe.revalidate();

                }
                break;
            }
        }

    }

}

From source file:LicenseGenerator.java

private void checkAdapter(JCheckBox chk, JTextField txt, int[] adapterFlag, String[] adapterDate) {
    if (chk.isSelected()) {
        String name = chk.getText();

        int i;// w w w.  j  av  a 2 s.co m
        i = (name.substring(0, name.lastIndexOf('.')).hashCode() & 0x7fffffff) % 64;
        if (name.endsWith(".s"))
            i += 64;

        System.out.println("adapter = " + name + " id = " + i + " limit = " + txt.getText());

        adapterFlag[i] = 1;
        adapterDate[i] = txt.getText();
    }
}

From source file:com.unicornlabs.kabouter.gui.power.PowerPanel.java

private void liveCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_liveCheckBoxActionPerformed
    JCheckBox source = (JCheckBox) evt.getSource();
    endTimeSpinner.setEnabled(!source.isSelected());
    endDateChooser.setEnabled(!source.isSelected());
    startTimeSpinner.setEnabled(!source.isSelected());
    startDateChooser.setEnabled(!source.isSelected());
}

From source file:com.google.cloud.tools.intellij.appengine.cloud.AppEngineDeploymentRunConfigurationEditor.java

private void resetOverridableFields(JCheckBox overrideCheckbox, JTextField field) {
    field.setEditable(overrideCheckbox.isSelected());
}