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

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

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

JTabbedPane.isRequestFocusEnabled介绍

暂无

代码示例

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

public void mousePressed(MouseEvent e)
  {
    if (!tabPane.isEnabled())
    {
      return;
    }
    int tabIndex= getTabAtLocation(e.getX(), e.getY());
    if (tabIndex >= 0 && tabPane.isEnabledAt(tabIndex))
    {
      if (tabIndex == tabPane.getSelectedIndex())
      {
        if (tabPane.isRequestFocusEnabled())
        {
          tabPane.requestFocus();
          tabPane.repaint(rects[tabIndex]);
        }
      }
      else
      {
        tabPane.setSelectedIndex(tabIndex);
      }
    }
  }
}

代码示例来源:origin: com.jtattoo/JTattoo

protected void paintFocusIndicator(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected) {
  if (tabPane.isRequestFocusEnabled() && tabPane.hasFocus() && isSelected && tabIndex >= 0 && textRect.width > 8) {
    g.setColor(AbstractLookAndFeel.getTheme().getFocusColor());
    BasicGraphicsUtils.drawDashedRect(g, textRect.x - 4, textRect.y + 1, textRect.width + 8, textRect.height);
  }
}

代码示例来源:origin: org.java.net.substance/substance

public void mousePressed(MouseEvent e) {
  if (!tabPane.isEnabled()) {
    return;
  }
  int tabIndex = tabForCoordinate(tabPane, e.getX(), e.getY());
  if (tabIndex >= 0 && tabPane.isEnabledAt(tabIndex)) {
    Rectangle rect = new Rectangle();
    rect = getTabBounds(tabIndex, rect);
    Rectangle close = getCloseButtonRectangleForEvents(tabIndex,
        rect.x, rect.y, rect.width, rect.height);
    boolean inCloseButton = close.contains(e.getPoint());
    this.tabOfPressedCloseButton = inCloseButton ? tabIndex : -1;
    if (tabIndex != tabPane.getSelectedIndex()) {
      // enhancement 307 - don't select tab on pressing its
      // close button
      if (inCloseButton) {
        return;
      }
      // Clicking on unselected tab, change selection, do NOT
      // request focus.
      // This will trigger the focusIndex to change by way
      // of stateChanged.
      tabPane.setSelectedIndex(tabIndex);
    } else if (tabPane.isRequestFocusEnabled()) {
      // Clicking on selected tab, try and give the tabbedpane
      // focus. Repaint will occur in focusGained.
      tabPane.requestFocus();
    }
  }
}

代码示例来源:origin: com.github.insubstantial/substance

} else if (tabPane.isRequestFocusEnabled()) {

代码示例来源:origin: com.jtattoo/JTattoo

protected void paintFocusIndicator(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected) {
  if (tabPane.isRequestFocusEnabled() && tabPane.hasFocus() && isSelected && tabIndex >= 0 && textRect.width > 8) {
    g.setColor(AbstractLookAndFeel.getTheme().getFocusColor());
    BasicGraphicsUtils.drawDashedRect(g, textRect.x - 4, textRect.y, textRect.width + 8, textRect.height);
    BasicGraphicsUtils.drawDashedRect(g, textRect.x - 3, textRect.y + 1, textRect.width + 6, textRect.height - 2);
  }
}

代码示例来源:origin: com.jtattoo/JTattoo

public void mousePressed(MouseEvent e) {
  if (scrollableTabLayoutEnabled()) {
    MouseListener[] ml = tabPane.getMouseListeners();
    for (int i = 0; i < ml.length; i++) {
      ml[i].mousePressed(e);
    }
  }
  if (!tabPane.isEnabled()) {
    return;
  }
  int tabIndex = getTabAtLocation(e.getX(), e.getY());
  if (tabIndex >= 0 && tabPane.isEnabledAt(tabIndex)) {
    if (tabIndex == tabPane.getSelectedIndex()) {
      if (tabPane.isRequestFocusEnabled()) {
        tabPane.requestFocus();
        tabPane.repaint(getTabBounds(tabPane, tabIndex));
      }
    } else {
      tabPane.setSelectedIndex(tabIndex);
    }
  }
}

代码示例来源:origin: girtel/Net2Plan

if (tabPane.isRequestFocusEnabled())

相关文章

JTabbedPane类方法