Example usage for javax.swing JButton setToolTipText

List of usage examples for javax.swing JButton setToolTipText

Introduction

In this page you can find the example usage for javax.swing JButton 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:org.openmicroscopy.shoola.agents.fsimporter.ImporterAgent.java

/** Registers the agent with the tool bar.*/
private void register() {
    String description = "Open the Importer.";
    TaskBar tb = registry.getTaskBar();//www  .jav  a 2  s  .  co  m
    IconManager icons = IconManager.getInstance();
    JButton b = new JButton(icons.getIcon(IconManager.IMPORT));
    b.setToolTipText(description);
    ActionListener l = new ActionListener() {

        /** Posts an event to start the agent.*/
        public void actionPerformed(ActionEvent e) {
            EventBus bus = registry.getEventBus();
            ExperimenterData exp = (ExperimenterData) registry.lookup(LookupNames.CURRENT_USER_DETAILS);
            if (exp == null)
                return;
            GroupData gp = null;
            try {
                gp = exp.getDefaultGroup();
            } catch (Exception ex) {
                //No default group
            }
            long id = -1;
            if (gp != null)
                id = gp.getId();
            if (groupId == -1)
                groupId = id;
            LoadImporter event = new LoadImporter(null, browserType);
            event.setGroup(groupId);
            event.setObjects(objects);
            bus.post(event);
        }
    };
    b.addActionListener(l);
    tb.addToToolBar(TaskBar.AGENTS, b);
    JMenuItem item = new JMenuItem(icons.getIcon(IconManager.IMPORT));
    item.setText("Import...");
    item.setToolTipText(description);
    item.addActionListener(l);
    tb.addToMenu(TaskBar.FILE_MENU, item);
}

From source file:org.openmicroscopy.shoola.agents.metadata.editor.PropertiesUI.java

/**
 * Formats the specified button./*w  w w.  j  av a 2  s . c o  m*/
 * 
 * @param button The button to handle.
 * @param text The tool tip text.
 * @param actionID The action command id.
 */
private void formatButton(JButton button, String text, int actionID) {
    button.setOpaque(false);
    UIUtilities.unifiedButtonLookAndFeel(button);
    button.setBackground(UIUtilities.BACKGROUND_COLOR);
    button.setToolTipText(text);
    button.addActionListener(this);
    button.setActionCommand("" + actionID);
}

From source file:org.openmicroscopy.shoola.agents.util.finder.AdvancedFinder.java

/**
 * Creates a list of controls to add to the searching component.
 * /*  w w  w . j  a v  a  2s  . c o  m*/
 * @return See above.
 */
private List<JButton> createControls() {
    List<JButton> list = new ArrayList<JButton>();
    IconManager icons = IconManager.getInstance();
    JButton button = new JButton(icons.getIcon(IconManager.TAG));
    UIUtilities.unifiedButtonLookAndFeel(button);
    button.setToolTipText("Load existing Tags to search by.");
    button.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            loadTags();
        }
    });
    list.add(button);
    return list;
}

From source file:org.openmicroscopy.shoola.util.ui.MessengerDialog.java

/**
 * Formats the specified button./*from   ww  w. j  ava2  s . c  o  m*/
 * 
 * @param b         The button to format.
 * @param mnemonic   The key-code that indicates a mnemonic key.
 * @param tooltip   The button's tooltip.
 * @param actionID   The action id associated to the passed button.
 */
private void formatButton(JButton b, int mnemonic, String tooltip, int actionID) {
    b.setMnemonic(mnemonic);
    b.setOpaque(false);
    b.setToolTipText(tooltip);
    b.addActionListener(this);
    b.setActionCommand("" + actionID);
}

From source file:org.openmicroscopy.shoola.util.ui.omeeditpane.OMEWikiComponent.java

/** Installs the default actions.  */
private void installDefaultAction() {
    columns = COLUMNS;//from w w w .  j ava 2 s.  c  o  m
    wrapWord = true;
    toolBarActions = new ArrayList<JButton>();
    IconManager icons = IconManager.getInstance();
    JButton b = new JButton(icons.getIcon(IconManager.HYPERLINK));
    b.addActionListener(this);
    b.setActionCommand("" + HYPERLINK);
    b.setToolTipText(OMEWikiConstants.HYPERLINK_TOOLTIP);
    toolBarActions.add(b);
    /*
    b = new JButton(icons.getIcon(IconManager.IMAGE));
    b.setToolTipText(OMEWikiConstants.IMAGE_TOOLTIP);
    b.addActionListener(this);
    b.setActionCommand(""+IMAGE);
    toolBarActions.add(b);
    b = new JButton(icons.getIcon(IconManager.FILE_EDITOR));
    b.setToolTipText(OMEWikiConstants.PROTOCOL_TOOLTIP);
    b.addActionListener(this);
    b.setActionCommand(""+PROTOCOL);
    //UIUtilities.unifiedButtonLookAndFeel(b);
     *
     */
    toolBarActions.add(b);
}

From source file:org.parosproxy.paros.extension.manualrequest.http.impl.ManualHttpRequestEditorDialog.java

@Override
protected Component getManualSendPanel() {
    if (requestResponsePanel == null) {
        requestResponsePanel = new RequestResponsePanel(configurationKey, getRequestPanel(),
                getResponsePanel());/*from ww  w  .  j  a va 2  s . co m*/

        if (helpKey != null) {
            JButton helpButton = new JButton();
            helpButton.setIcon(ExtensionHelp.HELP_ICON);
            helpButton.setToolTipText(Constant.messages.getString("help.dialog.button.tooltip"));
            helpButton.addActionListener(new java.awt.event.ActionListener() {
                @Override
                public void actionPerformed(java.awt.event.ActionEvent e) {
                    ExtensionHelp.showHelp(helpKey);
                }
            });
            requestResponsePanel.addToolbarButton(helpButton);
        }

        requestResponsePanel.addEndButton(getBtnSend());
        requestResponsePanel.addSeparator();

        requestResponsePanel.loadConfig();
    }
    return requestResponsePanel;
}

From source file:org.parosproxy.paros.view.OutputPanel.java

private JToolBar getToolBar() {
    if (mainToolBar == null) {
        mainToolBar = new JToolBar();
        mainToolBar.setEnabled(true);/*from w  w  w .java2s. c o m*/
        mainToolBar.setFloatable(false);
        mainToolBar.setRollover(true);

        JButton clearButton = new JButton(CLEAR_BUTTON_LABEL);
        clearButton.setToolTipText(CLEAR_BUTTON_TOOL_TIP);
        clearButton.setIcon(new ImageIcon(OutputPanel.class.getResource("/resource/icon/fugue/broom.png")));
        clearButton.addActionListener(new java.awt.event.ActionListener() {

            @Override
            public void actionPerformed(java.awt.event.ActionEvent e) {
                getTxtOutput().setText("");
            };
        });

        mainToolBar.add(clearButton);
    }
    return mainToolBar;
}

From source file:org.revager.gui.findings_list.FindingsListFrame.java

private void createToolBar() {

    JButton tbConfirmProt = GUITools.newImageButton(Data.getInstance().getIcon("confirmProtocol_50x50_0.png"),
            Data.getInstance().getIcon("confirmProtocol_50x50.png"));
    tbConfirmProt.setToolTipText(translate("Confirm and close list of findings"));
    tbConfirmProt.addActionListener(e -> {
        if (StringUtils.isBlank(protCommTxtArea.getText())) {
            currentProt.setComments("");
        }/*w  ww .  j  a va2  s . c o  m*/

        GUITools.executeSwingWorker(new ImageEditorWriteWorker(currentProt));

        setVisible(false);
        UI.getInstance().getPresentationFrame().setVisible(false);
    });

    addTopComponent(tbConfirmProt);

    JButton sepBttn = GUITools.newImageButton();
    sepBttn.setIcon(Data.getInstance().getIcon("sep_50x50.png"));
    sepBttn.setEnabled(false);
    addTopComponent(sepBttn);

    JButton tbPdfExport = GUITools.newImageButton(Data.getInstance().getIcon("PDFExport_50x50_0.png"),
            Data.getInstance().getIcon("PDFExport_50x50.png"));
    tbPdfExport.setToolTipText(translate("Export List of Findings as PDF File"));
    tbPdfExport.addActionListener(e -> UI.getInstance().getExportPDFProtocolDialog().setVisible(true));

    addTopComponent(tbPdfExport);

    JButton tbCsvExport = GUITools.newImageButton(Data.getInstance().getIcon("CSVExport_50x50_0.png"),
            Data.getInstance().getIcon("CSVExport_50x50.png"));
    tbCsvExport.setToolTipText(translate("Export List of Findings as CSV File"));
    tbCsvExport.addActionListener(e -> UI.getInstance().getExportCSVDialog().setVisible(true));

    addTopComponent(tbCsvExport);

    JButton tbPresenationView = GUITools.newImageButton(Data.getInstance().getIcon("tv_50x50_0.png"),
            Data.getInstance().getIcon("tv_50x50.png"));
    tbPresenationView.setToolTipText(translate("Open Presentation View"));
    tbPresenationView.addActionListener((ActionEvent e) -> {
        PresentationFrame presentationFrame = UI.getInstance().getPresentationFrame();
        presentationFrame.setVisible(!presentationFrame.isVisible());
    });
    addTopComponent(tbPresenationView);

    /*
     * Fullscreen
     */
    tbFullscreen = GUITools.newImageButton();
    if (fullscreen) {
        tbFullscreen.setIcon(Data.getInstance().getIcon("fullscreenClose_50x50_0.png"));
        tbFullscreen.setRolloverIcon(Data.getInstance().getIcon("fullscreenClose_50x50.png"));
        tbFullscreen.setToolTipText(translate("Exit Fullscreen"));
    } else {
        tbFullscreen.setIcon(Data.getInstance().getIcon("fullscreen_50x50_0.png"));
        tbFullscreen.setRolloverIcon(Data.getInstance().getIcon("fullscreen_50x50.png"));
        tbFullscreen.setToolTipText(translate("Change to Fullscreen mode"));
    }
    tbFullscreen.addActionListener(e -> UI.getInstance().getProtocolFrame(!isFullscreen()).setVisible(true));

    addTopComponent(tbFullscreen);

    /*
     * current time
     */
    clockCurrentTime.setFont(UI.VERY_LARGE_FONT);

    addTopRightComp(clockCurrentTime);

    /*
     * The clock
     */
    addTopRightComp(new JLabel(Data.getInstance().getIcon("blank_50x50.png")));

    clockLabel.setFont(UI.VERY_LARGE_FONT);

    clockButtonStart = GUITools.newImageButton();

    clockButtonStart.addActionListener(e -> {
        if (clockWorker.isClockRunning()) {
            clockWorker.stopClock();
        } else {
            clockWorker.startClock();
        }
        updateClockButtons();
    });

    JButton clockButtonReset = GUITools.newImageButton(Data.getInstance().getIcon("clockReset_24x24_0.png"),
            Data.getInstance().getIcon("clockReset_24x24.png"));
    clockButtonReset.setToolTipText(translate("Reset Stop Watch"));
    clockButtonReset.addActionListener(e -> {
        clockWorker.resetClock();
        updateClockButtons();
    });

    addTopRightComp(clockButtonReset);
    addTopRightComp(clockLabel);
    addTopRightComp(clockButtonStart);

    /*
     * Update clock elements
     */
    updateClock(0);
    updateClockButtons();
    updateCurrentTime();
}

From source file:org.revager.gui.findings_list.FindingsListFrame.java

private void createAttPanel() {
    GridLayout grid = new GridLayout(4, 1);
    grid.setVgap(8);/*from   w ww.  j  a v  a 2s.  com*/

    JPanel attendeeButtons = new JPanel(grid);

    addResiAtt = GUITools.newImageButton();
    addResiAtt.setIcon(Data.getInstance().getIcon("addResiAtt_25x25_0.png"));
    addResiAtt.setRolloverIcon(Data.getInstance().getIcon("addResiAtt_25x25.png"));
    addResiAtt.setToolTipText(translate("Add Attendee from the Attendee Pool"));
    addResiAtt.addActionListener(ActionRegistry.getInstance().get(AddResiAttToProtAction.class.getName()));
    attendeeButtons.add(addResiAtt);

    JButton addAttendee = GUITools.newImageButton();
    addAttendee.setIcon(Data.getInstance().getIcon("addAttendee_25x25_0.png"));
    addAttendee.setRolloverIcon(Data.getInstance().getIcon("addAttendee_25x25.png"));
    addAttendee.setToolTipText(translate("Add Attendee"));
    addAttendee.addActionListener(ActionRegistry.getInstance().get(AddAttToProtAction.class.getName()));
    attendeeButtons.add(addAttendee);

    removeAttendee = GUITools.newImageButton();
    removeAttendee.setIcon(Data.getInstance().getIcon("removeAttendee_25x25_0.png"));
    removeAttendee.setRolloverIcon(Data.getInstance().getIcon("removeAttendee_25x25.png"));
    removeAttendee.setToolTipText(translate("Remove Attendee"));
    removeAttendee.addActionListener(ActionRegistry.getInstance().get(RemAttFromProtAction.class.getName()));
    attendeeButtons.add(removeAttendee);

    editAttendee = GUITools.newImageButton();
    editAttendee.setIcon(Data.getInstance().getIcon("editAttendee_25x25_0.png"));
    editAttendee.setRolloverIcon(Data.getInstance().getIcon("editAttendee_25x25.png"));
    editAttendee.setToolTipText(translate("Edit Attendee"));
    editAttendee.addActionListener(ActionRegistry.getInstance().get(EditAttFromProtAction.class.getName()));
    attendeeButtons.add(editAttendee);

    editAttendee.setEnabled(false);
    removeAttendee.setEnabled(false);

    presentAttTable.setRowHeight(55);
    presentAttTable.getColumnModel().getColumn(0).setMaxWidth(55);
    presentAttTable.setShowHorizontalLines(false);
    presentAttTable.setShowVerticalLines(true);
    presentAttTable.setShowGrid(true);
    presentAttTable.addMouseListener(new MouseListener() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
                ActionRegistry.getInstance().get(EditAttFromProtAction.class.getName()).actionPerformed(null);
            }
        }

        @Override
        public void mouseEntered(MouseEvent e) {
        }

        @Override
        public void mouseExited(MouseEvent e) {
        }

        @Override
        public void mousePressed(MouseEvent e) {
        }

        @Override
        public void mouseReleased(MouseEvent e) {
        }
    });

    TableCellRenderer renderer = (table, value, isSelected, hasFocus, row, column) -> {
        JLabel label = new JLabel((String) value);
        label.setOpaque(true);
        label.setBorder(new EmptyBorder(5, 5, 5, 5));

        label.setFont(UI.VERY_LARGE_FONT);

        if (isSelected) {
            label.setBackground(presentAttTable.getSelectionBackground());
        } else {
            if (row % 2 == 0) {
                label.setBackground(UI.TABLE_ALT_COLOR);
            } else {
                label.setBackground(presentAttTable.getBackground());
            }
        }
        return label;
    };

    for (int i = 1; i <= 4; i++) {
        presentAttTable.getColumnModel().getColumn(i).setCellRenderer(renderer);
    }

    TableColumn col = presentAttTable.getColumnModel().getColumn(0);
    col.setCellRenderer((table, value, isSelected, hasFocus, row, column) -> {
        JPanel localPnl = new JPanel();
        localPnl.add(new JLabel(Data.getInstance().getIcon("attendee_40x40.png")));
        if (isSelected) {
            localPnl.setBackground(presentAttTable.getSelectionBackground());
        } else {
            if (row % 2 == 0) {
                localPnl.setBackground(UI.TABLE_ALT_COLOR);
            } else {
                localPnl.setBackground(presentAttTable.getBackground());
            }
        }
        return localPnl;
    });
    presentAttTable.addMouseListener(new MouseListener() {
        @Override
        public void mouseClicked(MouseEvent e) {
            updateAttButtons();
        }

        @Override
        public void mouseEntered(MouseEvent e) {
        }

        @Override
        public void mouseExited(MouseEvent e) {
        }

        @Override
        public void mousePressed(MouseEvent e) {
        }

        @Override
        public void mouseReleased(MouseEvent e) {
        }
    });

    scrllP = GUITools.setIntoScrollPane(presentAttTable);
    scrllP.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    scrllP.setToolTipText(translate("Add Attendee to Meeting"));
    scrllP.addMouseListener(new MouseListener() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if (isAddResiAttPossible()) {
                ActionRegistry.getInstance().get(AddResiAttToProtAction.class.getName()).actionPerformed(null);
            } else {
                ActionRegistry.getInstance().get(AddAttToProtAction.class.getName()).actionPerformed(null);
            }
        }

        @Override
        public void mouseEntered(MouseEvent e) {
        }

        @Override
        public void mouseExited(MouseEvent e) {
        }

        @Override
        public void mousePressed(MouseEvent e) {
        }

        @Override
        public void mouseReleased(MouseEvent e) {
        }
    });

    JLabel labelAttendees = new JLabel(translate("Attendees of the current meeting:"));
    labelAttendees.setFont(UI.HUGE_FONT_BOLD);

    GUITools.addComponent(attPanel, gbl, labelAttendees, 0, 0, 2, 1, 1.0, 0.0, 20, 20, 0, 20,
            GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);
    GUITools.addComponent(attPanel, gbl, scrllP, 0, 1, 1, 1, 1.0, 1.0, 20, 20, 0, 20, GridBagConstraints.BOTH,
            GridBagConstraints.NORTHWEST);
    GUITools.addComponent(attPanel, gbl, attendeeButtons, 1, 1, 1, 1, 0, 0, 20, 0, 20, 20,
            GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
}

From source file:org.revager.tools.GUITools.java

/**
 * Creates a new image button./*  w  w  w .  j av a  2s.  co m*/
 * 
 * @param icon
 *            the normal icon
 * @param rolloverIcon
 *            the rollover icon
 * @param action
 *            the action
 * 
 * @return the newly created image button
 */
public static JButton newImageButton(ImageIcon icon, ImageIcon rolloverIcon, Action action) {
    JButton button = new JButton(action);
    button.setToolTipText(button.getText());
    button.setText(null);
    button.setContentAreaFilled(false);
    button.setBorder(new EmptyBorder(0, 0, 0, 0));
    button.setMargin(new Insets(0, 0, 0, 0));
    button.setBorderPainted(false);
    button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    button.setFocusPainted(false);
    button.setFocusable(false);

    button.setIcon(icon);
    button.setRolloverIcon(rolloverIcon);
    button.setRolloverSelectedIcon(rolloverIcon);
    button.setSelectedIcon(rolloverIcon);
    return button;
}