Example usage for javax.swing JCheckBox setToolTipText

List of usage examples for javax.swing JCheckBox setToolTipText

Introduction

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

Prototype

@BeanProperty(bound = false, preferred = true, description = "The text to display in a tool tip.")
public void setToolTipText(String text) 

Source Link

Document

Registers the text to display in a tool tip.

Usage

From source file:Main.java

public static void main(String args[]) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JCheckBox checkBox = new JCheckBox("A");

    checkBox.setToolTipText("Italic font");

    frame.add(checkBox, BorderLayout.NORTH);
    frame.setSize(300, 100);/*from ww  w  .  j  av a2  s.c  o m*/
    frame.setVisible(true);
}

From source file:de.fhg.iais.asc.ui.i18n.LocalizedUI.java

public static JCheckBox createCheckbox(String key, ActionListener listener) {
    key = "Checkbox." + key;
    String tooltipText = Messages.getString("Tooltip." + key, "");

    JCheckBox checkBox = new JCheckBox(Messages.getString(key));
    if (!StringUtils.isEmpty(tooltipText)) {
        checkBox.setToolTipText(tooltipText);
    }//from   w w w .  ja v  a 2s. co m

    if (listener != null) {
        checkBox.addActionListener(listener);
    }

    return checkBox;
}

From source file:Main.java

public Main() {
    JCheckBox m_chkBold = new JCheckBox("Bold");
    m_chkBold.setMnemonic('b');
    m_chkBold.setToolTipText("Bold font");
    add(m_chkBold);/*ww  w  .j  av  a2  s  . c  o m*/
    setBorder(new TitledBorder(new EtchedBorder(), "Effects"));
    JCheckBox m_chkItalic = new JCheckBox("Italic");
    m_chkItalic.setMnemonic('i');
    m_chkItalic.setToolTipText("Italic font");
    add(m_chkItalic);
    JCheckBox m_chkUnderline = new JCheckBox("Underline");
    m_chkUnderline.setMnemonic('u');
    m_chkUnderline.setToolTipText("Underline font");
    add(m_chkUnderline);
    JCheckBox m_chkStrikethrough = new JCheckBox("Strikethrough");
    m_chkStrikethrough.setMnemonic('r');
    m_chkStrikethrough.setToolTipText("Strikethrough font");
    add(m_chkStrikethrough);
    JCheckBox m_chkSubscript = new JCheckBox("Subscript");
    m_chkSubscript.setMnemonic('t');
    m_chkSubscript.setToolTipText("Subscript font");
    add(m_chkSubscript);
    JCheckBox m_chkSuperscript = new JCheckBox("Superscript");
    m_chkSuperscript.setMnemonic('p');
    m_chkSuperscript.setToolTipText("Superscript font");
    add(m_chkSuperscript);

}

From source file:CheckBoxMnemonic.java

public CheckBoxMnemonic() {
    JCheckBox m_chkBold = new JCheckBox("Bold");
    m_chkBold.setMnemonic('b');
    m_chkBold.setToolTipText("Bold font");
    add(m_chkBold);//  w  w  w .  jav a2s . c o  m
    setBorder(new TitledBorder(new EtchedBorder(), "Effects"));
    JCheckBox m_chkItalic = new JCheckBox("Italic");
    m_chkItalic.setMnemonic('i');
    m_chkItalic.setToolTipText("Italic font");
    add(m_chkItalic);
    JCheckBox m_chkUnderline = new JCheckBox("Underline");
    m_chkUnderline.setMnemonic('u');
    m_chkUnderline.setToolTipText("Underline font");
    add(m_chkUnderline);
    JCheckBox m_chkStrikethrough = new JCheckBox("Strikethrough");
    m_chkStrikethrough.setMnemonic('r');
    m_chkStrikethrough.setToolTipText("Strikethrough font");
    add(m_chkStrikethrough);
    JCheckBox m_chkSubscript = new JCheckBox("Subscript");
    m_chkSubscript.setMnemonic('t');
    m_chkSubscript.setToolTipText("Subscript font");
    add(m_chkSubscript);
    JCheckBox m_chkSuperscript = new JCheckBox("Superscript");
    m_chkSuperscript.setMnemonic('p');
    m_chkSuperscript.setToolTipText("Superscript font");
    add(m_chkSuperscript);

}

From source file:com.xtructure.xevolution.gui.components.CollectArgsDialog.java

/**
 * Creates a new {@link CollectArgsDialog}
 * /*w  w w  . ja  v a 2s .  c  om*/
 * @param frame
 *            the parent JFrame for the new {@link CollectArgsDialog}
 * @param statusBar
 *            the {@link StatusBar} to update (can be null)
 * @param title
 *            the title of the new {@link CollectArgsDialog}
 * @param xOptions
 *            the {@link Collection} of {@link XOption}s for which to
 *            collect user input
 */
public CollectArgsDialog(JFrame frame, final StatusBar statusBar, String title,
        final Collection<XOption<?>> xOptions) {
    super(frame, title, true);

    argComponents = new ArrayList<JComponent>();

    final CollectArgsDialog dialog = this;
    JPanel panel = new JPanel(new GridBagLayout());
    getContentPane().add(panel);
    GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(3, 3, 3, 3);
    c.fill = GridBagConstraints.BOTH;

    int row = 0;
    for (XOption<?> xOption : xOptions) {
        if (xOption.getName() == null) {
            continue;
        }
        if (xOption.hasArg()) {
            JLabel label = new JLabel(xOption.getName());
            JTextField textField = new JTextField();
            textField.setName(xOption.getOpt());
            textField.setToolTipText(xOption.getDescription());
            argComponents.add(textField);
            c.gridx = 0;
            c.gridy = row;
            panel.add(label, c);
            c.gridx = 1;
            c.gridy = row;
            panel.add(textField, c);
        } else {
            JCheckBox checkBox = new JCheckBox(xOption.getName());
            checkBox.setName(xOption.getOpt());
            checkBox.setToolTipText(xOption.getDescription());
            argComponents.add(checkBox);
            c.gridx = 0;
            c.gridy = row;
            panel.add(checkBox, c);
        }
        row++;
    }

    JPanel buttonPanel = new JPanel();
    c.gridx = 1;
    c.gridy = row;
    panel.add(buttonPanel, c);

    JButton okButton = new JButton(new AbstractAction("OK") {
        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent e) {
            dialog.setVisible(false);
            if (statusBar != null) {
                statusBar.setMessage("building args...");
            }
            ArrayList<String> args = new ArrayList<String>();
            for (JComponent component : argComponents) {
                if (component instanceof JCheckBox) {
                    JCheckBox checkbox = (JCheckBox) component;
                    String opt = checkbox.getName();
                    if (checkbox.isSelected()) {
                        args.add("-" + opt);
                    }
                }
                if (component instanceof JTextField) {
                    JTextField textField = (JTextField) component;
                    String opt = textField.getName();
                    String text = textField.getText().trim();
                    if (!text.isEmpty()) {
                        args.add("-" + opt);
                        args.add("\"" + text + "\"");
                    }
                }
            }
            if (statusBar != null) {
                statusBar.setMessage("parsing args...");
            }
            try {
                Options options = new Options();
                for (XOption<?> xOpt : xOptions) {
                    options.addOption(xOpt);
                }
                XOption.parseArgs(options, args.toArray(new String[0]));
                dialog.success = true;
            } catch (ParseException e1) {
                e1.printStackTrace();
                dialog.success = false;
            }
            if (statusBar != null) {
                statusBar.clearMessage();
            }
        }
    });
    buttonPanel.add(okButton);
    getRootPane().setDefaultButton(okButton);

    buttonPanel.add(new JButton(new AbstractAction("Cancel") {
        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent e) {
            dialog.setVisible(false);
            if (statusBar != null) {
                statusBar.clearMessage();
            }
        }
    }));
    pack();
    setLocationRelativeTo(frame);
    setVisible(true);
}

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

void addUpgradeSelectionComponent() {
    upgradeSelectionPanel.invalidate();/*from  w  w  w  .j  a v a  2s  . c  om*/
    upgradeSelectionPanel.removeAll();
    for (Iterator i = upgrades.iterator(); i.hasNext();) {
        AbstractDatabaseUpgrade upgrade = (AbstractDatabaseUpgrade) i.next();
        JCheckBox box = new JCheckBox(upgrade.getName());
        box.setSelected(upgrade.isSelectedByDefault());
        box.setToolTipText(upgrade.getDescription());
        upgradeSelectionPanel.add(box);
        box.putClientProperty("upgrade", upgrade);
    }
    upgradeSelectionPanel.validate();
}

From source file:net.sf.housekeeper.swing.FoodEditorView.java

/**
 * Creates the checkbox for enabling or disabling the setting of an expiry
 * date.//from   w  w w  . j  ava  2 s.  c o  m
 * 
 * @return The created checkbox.
 */
private JCheckBox createExpiryEnabledCheckbox() {
    final JCheckBox checkBox = new JCheckBox();
    final String toolTip = LocalisationManager.INSTANCE.getText("gui.foodEditor.expiryCheckBoxToolTip");
    checkBox.setToolTipText(toolTip);

    return checkBox;
}

From source file:net.sf.housekeeper.swing.FoodItemEditorView.java

/**
 * Creates the checkbox for enabling or disabling the setting of an expiry
 * date./*  w w  w.  ja  v a2 s  .c o  m*/
 * 
 * @return The created checkbox.
 */
private JCheckBox createExpiryEnabledCheckbox() {
    final JCheckBox checkBox = new JCheckBox();
    final String toolTip = LocalisationManager.INSTANCE.getText("gui.foodItemEditor.expiryCheckBoxToolTip");
    checkBox.setToolTipText(toolTip);

    return checkBox;
}

From source file:es.emergya.ui.gis.popups.ListaCapas.java

private void addCapa(final GpxLayer layer) {
    final JPanel capaP = new JPanel();
    capaP.setOpaque(false);//  w ww .  ja v  a 2 s .c o m
    layer.visible = true;
    mapView.addLayer(layer, false, capasActuales.size());
    capasActuales.add(layer);
    capaP.setLayout(new BoxLayout(capaP, BoxLayout.X_AXIS));

    final JCheckBox capa = new JCheckBox(layer.getAssociatedFile().getAbsolutePath());
    capa.setSelected(layer.visible);
    capa.setBackground(Color.WHITE);
    capa.setToolTipText(i18n.getString("window.gpx.checkbox.show.tooltip"));
    capa.setActionCommand(layer.name);
    capa.addActionListener(this);
    capaP.add(capa);
    capaP.add(Box.createHorizontalGlue());
    JButton eliminar = new JButton(LogicConstants.getIcon("button_delone"));
    eliminar.setToolTipText(i18n.getString("window.gpx.button.delete.tooltip"));
    eliminar.setBorderPainted(false);
    eliminar.setContentAreaFilled(false);

    capaP.add(eliminar);
    eliminar.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            mapView.removeLayer(layer);
            mapView.repaint();
            capasGpx.remove(capaP);
            capasGpx.updateUI();
            capasActuales.remove(layer);
        }
    });

    capasGpx.add(capaP);
    capasGpx.updateUI();
}

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);/* w w w  .  j  av  a  2s .  c om*/
            cb.setToolTipText(prepTooltip(description, allowable, verRange));
        }
    }
}