Example usage for javax.swing JCheckBox getClientProperty

List of usage examples for javax.swing JCheckBox getClientProperty

Introduction

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

Prototype

public final Object getClientProperty(Object key) 

Source Link

Document

Returns the value of the property with the specified key.

Usage

From source file:com.github.alexfalappa.nbspringboot.projects.initializr.BootDependenciesPanel.java

void adaptToBootVersion(String bootVersion) {
    for (List<JCheckBox> chList : chkBoxesMap.values()) {
        for (JCheckBox cb : chList) {
            String verRange = (String) cb.getClientProperty(PROP_VERSION_RANGE);
            String description = (String) cb.getClientProperty(PROP_DESCRIPTION);
            final boolean allowable = allowable(verRange, bootVersion);
            cb.setEnabled(allowable);/*from   w ww  .  java 2 s  .c om*/
            cb.setToolTipText(prepTooltip(description, allowable, verRange));
        }
    }
}

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) {
        ////from w ww.  java 2s. c  o  m
        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:storybook.model.EntityUtil.java

public static List<JCheckBox> createPersonCheckBoxes(MainFrame mainFrame, List<JCheckBox> cbl,
        ActionListener comp) {/*from   www .j  av  a2s. com*/
    List<JCheckBox> list = new ArrayList<>();
    BookModel model = mainFrame.getBookModel();
    Session session = model.beginTransaction();
    PersonDAOImpl dao = new PersonDAOImpl(session);
    for (JCheckBox cb : cbl) {
        if (cb.isSelected()) {
            Category category = (Category) cb.getClientProperty(SbConstants.ComponentName.CB_CATEGORY);
            List<Person> persons = dao.findByCategory(category);
            for (Person person : persons) {
                JCheckBox cbPerson = new JCheckBox(person.getFullNameAbbr());
                cbPerson.setOpaque(false);
                cbPerson.putClientProperty(SbConstants.ComponentName.CB_PERSON, person);
                cbPerson.addActionListener(comp);
                list.add(cbPerson);
            }
        }
    }
    model.commit();
    return list;
}