javax.swing.JButton.setToolTipText()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(10.3k)|赞(0)|评价(0)|浏览(294)

本文整理了Java中javax.swing.JButton.setToolTipText()方法的一些代码示例,展示了JButton.setToolTipText()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JButton.setToolTipText()方法的具体详情如下:
包路径:javax.swing.JButton
类名称:JButton
方法名:setToolTipText

JButton.setToolTipText介绍

暂无

代码示例

代码示例来源:origin: apache/ignite

/**
 * @return Panel with close button.
 */
private JPanel createButtonPanel() {
  closeBtn.setAction(closeAct);
  closeBtn.setToolTipText("<html><b>Closes</b> Dialog</html>");
  JPanel btnPanel = new JPanel();
  btnPanel.add(closeBtn);
  return btnPanel;
}

代码示例来源:origin: skylot/jadx

public ProgressPanel(final MainWindow mainWindow, boolean showCancelButton) {
  progressLabel = new JLabel();
  progressBar = new JProgressBar(0, 100);
  progressBar.setIndeterminate(true);
  progressBar.setStringPainted(false);
  progressLabel.setLabelFor(progressBar);
  setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
  setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
  setVisible(false);
  add(progressLabel);
  add(progressBar);
  if (showCancelButton) {
    JButton cancelButton = new JButton(ICON_CANCEL);
    cancelButton.setPreferredSize(new Dimension(ICON_CANCEL.getIconWidth(), ICON_CANCEL.getIconHeight()));
    cancelButton.setToolTipText("Cancel background jobs");
    cancelButton.setBorderPainted(false);
    cancelButton.setFocusPainted(false);
    cancelButton.setContentAreaFilled(false);
    cancelButton.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        mainWindow.cancelBackgroundJobs();
      }
    });
    add(cancelButton);
  }
}

代码示例来源:origin: kiegroup/optaplanner

private void createUI() {
  JPanel labelAndDeletePanel = new JPanel(new BorderLayout());
  labelAndDeletePanel.setPreferredSize(new Dimension(150, 20));
  machineLabel = new JLabel(getMachineLabel());
  machineLabel.setEnabled(false);
  labelAndDeletePanel.add(machineLabel, BorderLayout.CENTER);
  if (machine != null) {
    JButton deleteButton = SwingUtils.makeSmallButton(new JButton("X"));
    deleteButton.setToolTipText("Delete");
    deleteButton.addActionListener(e -> machineReassignmentPanel.deleteMachine(machine));
    deleteButton.setToolTipText("Delete");
    labelAndDeletePanel.add(deleteButton, BorderLayout.EAST);
  JPanel numberAndDetailsPanel = new JPanel(new BorderLayout());
  numberOfProcessesLabel = new JLabel("0 processes ", JLabel.RIGHT);
  numberOfProcessesLabel.setPreferredSize(new Dimension(100, 20));
  numberOfProcessesLabel.setEnabled(false);
  numberAndDetailsPanel.add(numberOfProcessesLabel, BorderLayout.WEST);
  detailsButton = new JButton(new AbstractAction("Details") {
    @Override
    public void actionPerformed(ActionEvent e) {

代码示例来源:origin: kiegroup/optaplanner

public void addShiftAssignment(ShiftAssignment shiftAssignment) {
  Shift shift = shiftAssignment.getShift();
  JPanel shiftPanel = shiftPanelMap.get(shift);
  JButton shiftAssignmentButton = SwingUtils.makeSmallButton(new JButton(new ShiftAssignmentAction(shiftAssignment)));
  shiftAssignmentButton.setEnabled(shiftPanel.isEnabled());
  if (employee != null) {
    if (employee.getDayOffRequestMap().containsKey(shift.getShiftDate())
        || employee.getShiftOffRequestMap().containsKey(shift)) {
      shiftAssignmentButton.setForeground(TangoColorFactory.SCARLET_1);
    }
  }
  Color color = nurseRosteringPanel.determinePlanningEntityColor(shiftAssignment, shift.getShiftType());
  shiftAssignmentButton.setBackground(color);
  String toolTip = nurseRosteringPanel.determinePlanningEntityTooltip(shiftAssignment);
  shiftAssignmentButton.setToolTipText(toolTip);
  shiftPanel.add(shiftAssignmentButton);
  shiftPanel.repaint();
  shiftAssignmentButtonMap.put(shiftAssignment, shiftAssignmentButton);
}

代码示例来源:origin: kiegroup/optaplanner

JButton button = new JButton(new QueenAction(queen));
  button.setMinimumSize(new Dimension(20, 20));
  button.setPreferredSize(new Dimension(20, 20));
  button.setToolTipText(toolTip);
  add(button);
} else {
  JPanel panel = new JPanel();
  panel.setBorder(BorderFactory.createCompoundBorder(
      BorderFactory.createLineBorder(TangoColorFactory.ALUMINIUM_6),

代码示例来源:origin: kiegroup/optaplanner

private JButton createButton(Lecture lecture, Color color, String toolTip) {
  JButton button = SwingUtils.makeSmallButton(new JButton(new LectureAction(lecture)));
  button.setBackground(color);
  if (lecture.isPinned()) {
    button.setIcon(CommonIcons.PINNED_ICON);
  }
  button.setToolTipText(toolTip);
  return button;
}

代码示例来源:origin: wiztools/rest-client

jb_body_content_type.setToolTipText("Edit Content-type & Charset");
jb_body_content_type.addActionListener(new ActionListener() {
  @Override
  public void actionPerformed(ActionEvent ae) {

代码示例来源:origin: runelite/runelite

sidebarNavigationJButton.setToolTipText("Open SideBar");
sidebarNavigationJButton.setToolTipText("Close SideBar");
container.add(pluginToolbar);

代码示例来源:origin: stanfordnlp/CoreNLP

topPanel.setLayout(new java.awt.BorderLayout());
buttonsAndFilePanel.setLayout(new javax.swing.BoxLayout(buttonsAndFilePanel, javax.swing.BoxLayout.Y_AXIS));
loadButtonPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
loadFileButton.setToolTipText("Load a data file.");
loadFileButton.addActionListener(evt -> loadFileButtonActionPerformed(evt));
loadButtonPanel.add(loadFileButton);
loadParserButton.setToolTipText("Load a serialized parser.");
loadParserButton.addActionListener(evt -> loadParserButtonActionPerformed(evt));
saveOutputButton.setToolTipText("Save the processed output.");
saveOutputButton.setEnabled(false);
saveOutputButton.addActionListener(evt -> saveOutputButtonActionPerformed(evt));
backButton.setToolTipText("Scroll backward one sentence.");
forwardButton.setToolTipText("Scroll forward one sentence.");
parseButton.setToolTipText("Parse selected sentence.");
parseNextButton.setToolTipText("Parse selected sentence and then scrolls forward one sentence.");
clearButton.setToolTipText("Clears parse tree.");

代码示例来源:origin: log4j/log4j

JButton newButton = new JButton("Clear Log Table");
newButton.setToolTipText("Clear Log Table.");
newButton.addActionListener(
  new ActionListener() {
   public void actionPerformed(ActionEvent e) {

代码示例来源:origin: org.gridgain/gridgain-core

/**
 * @return Panel with close button.
 */
private JPanel createButtonPanel() {
  closeBtn.setAction(closeAct);
  closeBtn.setToolTipText("<html><b>Closes</b> Dialog</html>");
  JPanel btnPanel = new JPanel();
  btnPanel.add(closeBtn);
  return btnPanel;
}

代码示例来源:origin: kiegroup/optaplanner

private JButton createButton(Exam exam, Color color, String toolTip) {
  JButton button = SwingUtils.makeSmallButton(new JButton(new ExamAction(exam)));
  button.setBackground(color);
  button.setToolTipText(toolTip);
  if (exam instanceof FollowingExam) {
    button.setForeground(TangoColorFactory.ALUMINIUM_5);
  }
  return button;
}

代码示例来源:origin: wiztools/rest-client

jb_request.setToolTipText(TEXT_GO);
rest_ui.getFrame().getRootPane().setDefaultButton(jb_request);
jb_request.addActionListener(new ActionListener() {
  @Override
  public void actionPerformed(ActionEvent event) {

代码示例来源:origin: kiegroup/optaplanner

private void createUI() {
  JPanel labelAndDeletePanel = new JPanel(new BorderLayout(5, 0));
  if (employee != null) {
    labelAndDeletePanel.add(new JLabel(nurseRosteringPanel.getEmployeeIcon()), BorderLayout.WEST);
  }
  JLabel employeeLabel = new JLabel(getEmployeeLabel());
  employeeLabel.setEnabled(false);
  labelAndDeletePanel.add(employeeLabel, BorderLayout.CENTER);
  if (employee != null) {
    JPanel deletePanel = new JPanel(new BorderLayout());
    deleteButton = SwingUtils.makeSmallButton(new JButton(nurseRosteringPanel.getDeleteEmployeeIcon()));
    deleteButton.setToolTipText("Delete");
    deleteButton.addActionListener(e -> nurseRosteringPanel.deleteEmployee(employee));
    deletePanel.add(deleteButton, BorderLayout.NORTH);
    labelAndDeletePanel.add(deletePanel, BorderLayout.EAST);
  }
  labelAndDeletePanel.setPreferredSize(new Dimension(WEST_HEADER_WIDTH,
      (int) labelAndDeletePanel.getPreferredSize().getHeight()));
  add(labelAndDeletePanel, BorderLayout.WEST);
  resetShiftListPanel();
  numberOfShiftAssignmentsLabel = new JLabel("0 assignments", JLabel.RIGHT);
  numberOfShiftAssignmentsLabel.setPreferredSize(new Dimension(EAST_HEADER_WIDTH, 20));
  numberOfShiftAssignmentsLabel.setEnabled(false);
  add(numberOfShiftAssignmentsLabel, BorderLayout.EAST);
}

代码示例来源:origin: stanfordnlp/CoreNLP

JButton okay = new javax.swing.JButton();
okay.setText("Okay");
okay.setToolTipText("Okay");
okay.addActionListener(evt -> dialog.setVisible(false));
JButton cancel = new javax.swing.JButton();
cancel.setText("Cancel");
cancel.setToolTipText("Cancel");
cancel.addActionListener(evt -> {
 fileList.clearSelection();
 dialog.setVisible(false);

代码示例来源:origin: org.apache.ignite/ignite-core

/**
 * @return Panel with close button.
 */
private JPanel createButtonPanel() {
  closeBtn.setAction(closeAct);
  closeBtn.setToolTipText("<html><b>Closes</b> Dialog</html>");
  JPanel btnPanel = new JPanel();
  btnPanel.add(closeBtn);
  return btnPanel;
}

代码示例来源:origin: kiegroup/optaplanner

private JButton createButton(Match match, Team team, Team otherTeam, String toolTip) {
  Color color = determinePlanningEntityColor(match, otherTeam);
  String label = otherTeam.getLabel();
  JButton button = SwingUtils.makeSmallButton(new JButton(new MatchAction(match, label)));
  if (match.getAwayTeam() == team) {
    button.setIcon(awayMatchIcon);
  }
  button.setBackground(color);
  button.setToolTipText(toolTip);
  return button;
}

代码示例来源:origin: Nilhcem/FakeSMTP

button.setToolTipText(i18n.get("clearall.tooltip"));
button.addActionListener(new ActionListener() {
  @Override
  public void actionPerformed(ActionEvent e) {

代码示例来源:origin: skylot/jadx

warnLabel.setVisible(false);
JPanel paginationPanel = new JPanel();
paginationPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
paginationPanel.setLayout(new BoxLayout(paginationPanel, BoxLayout.X_AXIS));
resultsInfoLabel = new JLabel("");
JButton nextPageButton = new JButton("->");
nextPageButton.setToolTipText(NLS.str("search_dialog.next_page"));
nextPageButton.addActionListener(e -> {
  if (resultsModel.nextPage()) {
    switchPage(renderer);
JButton prevPageButton = new JButton("<-");
prevPageButton.setToolTipText(NLS.str("search_dialog.prev_page"));
prevPageButton.addActionListener(e -> {
  if (resultsModel.prevPage()) {
    switchPage(renderer);
paginationPanel.add(prevPageButton);
paginationPanel.add(nextPageButton);
paginationPanel.add(resultsInfoLabel);

代码示例来源:origin: stanfordnlp/CoreNLP

JButton cancel = new javax.swing.JButton();
cancel.setToolTipText("Cancel");
cancel.addActionListener(evt -> thread.cancelled = true);

相关文章

JButton类方法