javax.swing.JTabbedPane.getToolTipTextAt()方法的使用及代码示例

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

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

JTabbedPane.getToolTipTextAt介绍

暂无

代码示例

代码示例来源:origin: joel-costigliola/assertj-swing

@RunsInEDT
@Nullable private static String toolTipTextAt(final @Nonnull JTabbedPane tabbedPane, final @Nonnull Index index) {
 return execute(() -> tabbedPane.getToolTipTextAt(index.value));
}

代码示例来源:origin: com.github.arnabk/pgslookandfeel

public void mouseDragged(MouseEvent e) {
  if(draggedTabIndex == -1) {
    return;
  }
  int targetTabIndex = tabPane.getUI().tabForCoordinate(tabPane,
                             e.getX(), e.getY());
  if(targetTabIndex != -1 && targetTabIndex != draggedTabIndex) {
    boolean isForwardDrag = targetTabIndex > draggedTabIndex;
    tabPane.insertTab(tabPane.getTitleAt(draggedTabIndex),
             tabPane.getIconAt(draggedTabIndex),
             tabPane.getComponentAt(draggedTabIndex),
             tabPane.getToolTipTextAt(draggedTabIndex),
             isForwardDrag ? targetTabIndex+1 : targetTabIndex);
    draggedTabIndex = targetTabIndex;
    tabPane.setSelectedIndex(draggedTabIndex);
  }
}

代码示例来源:origin: org.bidib.jbidib.com.vldocking/vldocking

/** MouseListener implementation, use to track mouse behaviour inside the tab selector bounds
 * and forward them to the appropriate smart icon.
 */
public void mouseExited(MouseEvent e) {
  checkTabCount();
  if(movedIcon != null) {
    Point p = e.getPoint();
    // trigger a mouseExit from the movedIcon
    Rectangle prevRect = tabbedPane.getBoundsAt(movedTab);
    if (prevRect == null) {
      return;
    }
    Point iPoint = convertPointToIcon(prevRect, p, movedIcon);
    MouseEvent eSmart = new MouseEvent((Component) e.getSource(), MouseEvent.MOUSE_EXITED, e.getWhen(), e.getModifiers(), iPoint.x, iPoint.y, e.getClickCount(), e.isPopupTrigger(), e.getButton());
    if(movedIcon.onMouseExited(eSmart)) {
      String tip = movedIcon.getLocalTooltipText();
      if(tip != null && ! tip.equals(tabbedPane.getToolTipTextAt(movedTab))) {
        tabbedPane.setToolTipTextAt(movedTab, tip);
      }
      tabbedPane.repaint(prevRect.x, prevRect.y, prevRect.width, prevRect.height);
    }
    movedIcon = null;
    movedTab = - 1;
  }
}

代码示例来源:origin: xyz.cofe/gui.swing

tip = tabbedPane.getToolTipTextAt(index);
}else{
  tip = getToolTipText();

代码示例来源:origin: org.bidib.jbidib.com.vldocking/vldocking

if(movedIcon.onMouseExited(eSmart)) {
    String tip = movedIcon.getLocalTooltipText();
    if(tip != null && ! tip.equals(tabbedPane.getToolTipTextAt(targetTab))) {
      tabbedPane.setToolTipTextAt(targetTab, tip);
  if(smartIcon.onMouseMoved(eSmart)) {
    String tip = smartIcon.getLocalTooltipText();
    if(tip != null && ! tip.equals(tabbedPane.getToolTipTextAt(targetTab))) {
      tabbedPane.setToolTipTextAt(targetTab, tip);
    if(movedIcon.onMouseExited(eSmart)) {
      String tip = movedIcon.getLocalTooltipText();
      if(tip != null && ! tip.equals(tabbedPane.getToolTipTextAt(targetTab))) {
        tabbedPane.setToolTipTextAt(targetTab, tip);
  if(movedIcon.onMouseExited(eSmart)) {
    String tip = movedIcon.getLocalTooltipText();
    if(tip != null && ! tip.equals(tabbedPane.getToolTipTextAt(targetTab))) {
      tabbedPane.setToolTipTextAt(targetTab, tip);
if(movedIcon.onMouseExited(eSmart)) {
  String tip = movedIcon.getLocalTooltipText();
  if(tip != null && ! tip.equals(tabbedPane.getToolTipTextAt(movedTab))) {
    tabbedPane.setToolTipTextAt(movedTab, tip);

代码示例来源:origin: wildfly/wildfly-core

public void menuSelected(MenuEvent e) {
  TabsMenu.this.removeAll();
  ExploreNodeAction exploreAction = new ExploreNodeAction(cliGuiCtx);
  JMenuItem exploreSelectedNode = new JMenuItem(exploreAction);
  exploreSelectedNode.setMnemonic(KeyEvent.VK_E);
  if ((exploreAction.getSelectedNode() == null) || exploreAction.getSelectedNode().isLeaf()) {
    exploreSelectedNode.setEnabled(false);
  }
  add(exploreSelectedNode);
  addSeparator();
  JTabbedPane tabs = cliGuiCtx.getTabs();
  for (int i=0; i < tabs.getTabCount(); i++) {
    GoToTabAction action = new GoToTabAction(i, tabs.getTitleAt(i));
    JMenuItem item = new JMenuItem(action);
    item.setToolTipText(tabs.getToolTipTextAt(i));
    add(item);
  }
}

代码示例来源:origin: igniterealtime/Spark

private void moveTab(int prev, int next) {
  if (next < 0 || prev == next) {
    return;
  }
  Component cmp = pane.getComponentAt(prev);
  Component tab = pane.getTabComponentAt(prev);
  String str = pane.getTitleAt(prev);
  Icon icon = pane.getIconAt(prev);
  String tip = pane.getToolTipTextAt(prev);
  boolean flg = pane.isEnabledAt(prev);
  int tgtindex = prev > next ? next : next - 1;
  pane.remove(prev);
  pane.insertTab(str, icon, cmp, tip, tgtindex);
  pane.setEnabledAt(tgtindex, flg);
  if (flg)
    pane.setSelectedIndex(tgtindex);
  pane.setTabComponentAt(tgtindex, tab);
}

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

public void menuSelected(MenuEvent e) {
  TabsMenu.this.removeAll();
  ExploreNodeAction exploreAction = new ExploreNodeAction(cliGuiCtx);
  JMenuItem exploreSelectedNode = new JMenuItem(exploreAction);
  exploreSelectedNode.setMnemonic(KeyEvent.VK_E);
  if ((exploreAction.getSelectedNode() == null) || exploreAction.getSelectedNode().isLeaf()) {
    exploreSelectedNode.setEnabled(false);
  }
  add(exploreSelectedNode);
  addSeparator();
  JTabbedPane tabs = cliGuiCtx.getTabs();
  for (int i=0; i < tabs.getTabCount(); i++) {
    GoToTabAction action = new GoToTabAction(i, tabs.getTitleAt(i));
    JMenuItem item = new JMenuItem(action);
    item.setToolTipText(tabs.getToolTipTextAt(i));
    add(item);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui

firstName = tabs.getTitleAt(0);
firstIcon = tabs.getIconAt(0);
firstDescription = tabs.getToolTipTextAt(0);
remove(tabs);
add(firstView);

代码示例来源:origin: com.fifesoft.rtext/fife.common

Icon icon = sourcePane.getIconAt(sourceIndex);
Component comp = sourcePane.getComponentAt(sourceIndex);
String toolTip = sourcePane.getToolTipTextAt(sourceIndex);
Color foreground = sourcePane.getForegroundAt(sourceIndex);

代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql

private void convertTab(int prev, int next)
{
 if (next < 0 || prev == next)
 {
   return;
 }
 Component cmp = _dnDTabbedPaneData.getTabbedPane().getComponentAt(prev);
 Component tab = _dnDTabbedPaneData.getTabbedPane().getTabComponentAt(prev);
 String str = _dnDTabbedPaneData.getTabbedPane().getTitleAt(prev);
 Icon icon = _dnDTabbedPaneData.getTabbedPane().getIconAt(prev);
 String tip = _dnDTabbedPaneData.getTabbedPane().getToolTipTextAt(prev);
 boolean flg = _dnDTabbedPaneData.getTabbedPane().isEnabledAt(prev);
 int tgtindex = prev > next ? next : next - 1;
 _dnDTabbedPaneData.getTabbedPane().remove(prev);
 _dnDTabbedPaneData.getTabbedPane().insertTab(str, icon, cmp, tip, tgtindex);
 _dnDTabbedPaneData.getTabbedPane().setEnabledAt(tgtindex, flg);
 //When you drag'n'drop a disabled tab, it finishes enabled and selected.
 //pointed out by dlorde
 if (flg) _dnDTabbedPaneData.getTabbedPane().setSelectedIndex(tgtindex);
 //I have a component in all tabs (jlabel with an X to close the tab) and when i move a tab the component disappear.
 //pointed out by Daniel Dario Morales Salas
 _dnDTabbedPaneData.getTabbedPane().setTabComponentAt(tgtindex, tab);
}

代码示例来源:origin: realXuJiang/bigtable-sql

private void convertTab(int prev, int next)
{
 if (next < 0 || prev == next)
 {
   return;
 }
 Component cmp = _dnDTabbedPaneData.getTabbedPane().getComponentAt(prev);
 Component tab = _dnDTabbedPaneData.getTabbedPane().getTabComponentAt(prev);
 String str = _dnDTabbedPaneData.getTabbedPane().getTitleAt(prev);
 Icon icon = _dnDTabbedPaneData.getTabbedPane().getIconAt(prev);
 String tip = _dnDTabbedPaneData.getTabbedPane().getToolTipTextAt(prev);
 boolean flg = _dnDTabbedPaneData.getTabbedPane().isEnabledAt(prev);
 int tgtindex = prev > next ? next : next - 1;
 _dnDTabbedPaneData.getTabbedPane().remove(prev);
 _dnDTabbedPaneData.getTabbedPane().insertTab(str, icon, cmp, tip, tgtindex);
 _dnDTabbedPaneData.getTabbedPane().setEnabledAt(tgtindex, flg);
 //When you drag'n'drop a disabled tab, it finishes enabled and selected.
 //pointed out by dlorde
 if (flg) _dnDTabbedPaneData.getTabbedPane().setSelectedIndex(tgtindex);
 //I have a component in all tabs (jlabel with an X to close the tab) and when i move a tab the component disappear.
 //pointed out by Daniel Dario Morales Salas
 _dnDTabbedPaneData.getTabbedPane().setTabComponentAt(tgtindex, tab);
}

相关文章

JTabbedPane类方法