Example usage for javax.swing JPanel setToolTipText

List of usage examples for javax.swing JPanel setToolTipText

Introduction

In this page you can find the example usage for javax.swing JPanel 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:shuffle.fwk.service.teams.EditTeamService.java

private Component makeUpperPanel() {
    JPanel ret = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;/*from  ww w. j  a  v a  2s. co m*/
    c.weighty = 0.0;
    c.gridx = 1;
    c.gridy = 1;
    c.gridwidth = 1;
    c.gridheight = 1;

    c.gridx += 1;
    c.weightx = 0.0;
    JPanel typePanel = new JPanel();
    typePanel.add(new JLabel(getString(KEY_TYPE)));
    typeChooser = new TypeChooser(true);
    typePanel.add(typeChooser);
    typePanel.setToolTipText(getString(KEY_TYPE_TOOLTIP));
    typeChooser.setToolTipText(getString(KEY_TYPE_TOOLTIP));
    ret.add(typePanel, c);

    c.gridx += 1;
    c.weightx = 0.0;
    JPanel levelPanel = new JPanel();
    levelPanel.add(new JLabel(getString(KEY_LEVEL)));
    SpinnerNumberModel snm = new SpinnerNumberModel(0, 0, Species.MAX_LEVEL, 1);
    levelSpinner = new JSpinner(snm);
    levelPanel.add(levelSpinner);
    levelPanel.setToolTipText(getString(KEY_LEVEL_TOOLTIP));
    levelSpinner.setToolTipText(getString(KEY_LEVEL_TOOLTIP));
    ret.add(levelPanel, c);

    c.gridx += 1;
    c.weightx = 1.0;
    JPanel stringPanel = new JPanel(new GridBagLayout());
    GridBagConstraints sc = new GridBagConstraints();
    sc.fill = GridBagConstraints.HORIZONTAL;
    sc.gridx = 1;
    stringPanel.add(new JLabel(getString(KEY_NAME)), sc);
    textField = new JTextField();
    sc.gridx += 1;
    sc.weightx = 1.0;
    sc.insets = new Insets(0, 5, 0, 5);
    stringPanel.add(textField, sc);
    stringPanel.setToolTipText(getString(KEY_NAME_TOOLTIP));
    textField.setToolTipText(getString(KEY_NAME_TOOLTIP));
    ret.add(stringPanel, c);

    c.gridx += 1;
    c.weightx = 0.0;
    megaFilter = new JCheckBox(getString(KEY_MEGA_FILTER));
    megaFilter.setToolTipText(getString(KEY_MEGA_FILTER_TOOLTIP));
    ;
    ret.add(megaFilter, c);

    c.gridx += 1;
    c.weightx = 0.0;
    effectFilter = new EffectChooser(false, EffectChooser.DefaultEntry.NO_FILTER);
    effectFilter.setToolTipText(getString(KEY_EFFECT_FILTER_TOOLTIP));
    ret.add(effectFilter, c);

    c.gridx += 1;
    c.weightx = 0.0;
    @SuppressWarnings("serial")
    JButton copyToLauncher = new JButton(new AbstractAction(getString(KEY_MAKE_DEFAULT)) {
        @Override
        public void actionPerformed(ActionEvent e) {
            makeTeamDefault();
        }
    });
    copyToLauncher.setToolTipText(getString(KEY_MAKE_DEFAULT_TOOLTIP));
    ret.add(copyToLauncher, c);

    getMinUpperPanel = new Supplier<Dimension>() {

        @Override
        public Dimension get() {
            Dimension ret = new Dimension(10 + 50, 0);
            for (Component c : new Component[] { typePanel, levelPanel, stringPanel, megaFilter, effectFilter,
                    copyToLauncher }) {
                Dimension temp = c.getPreferredSize();
                int width = temp.width + ret.width;
                int height = Math.max(temp.height, ret.height);
                ret.setSize(width, height);
            }
            return ret;
        }
    };

    return ret;
}