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

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

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

JTabbedPane.isEnabled介绍

暂无

代码示例

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

protected Icon getIconForTab(int tabIndex)
{
  return (!tabPane.isEnabled() || !tabPane.isEnabledAt(tabIndex))
    ? tabPane.getDisabledIconAt(tabIndex)
    : tabPane.getIconAt(tabIndex);
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction(jsDoc = ENABLED_JSDOC)
@Override
public boolean getEnabled() {
  return super.isEnabled();
}

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

protected Icon getIconForTab(int tabIndex) {
  if (tabIndex >= 0 && tabIndex < tabCount) {
    return (!tabPane.isEnabled() || !tabPane.isEnabledAt(tabIndex)) ? tabPane.getDisabledIconAt(tabIndex) : tabPane.getIconAt(tabIndex);
  }
  return null;
}

代码示例来源:origin: khuxtable/seaglass

/**
 * Set the bounds Rectangle for a scroll button.
 *
 * @param child    the scroll button.
 * @param visible  whether the button is visible or not.
 * @param position the position from the start of the tab run.
 */
private void setScrollButtonPositions(Component child, boolean visible, int position) {
  if (visible) {
    child.setBounds(orientation.createBounds(position,
                         orientation.getOrthogonalOffset(rects[leadingTabIndex]),
                         orientation.getLength(child.getPreferredSize()),
                         orientation.getThickness(rects[leadingTabIndex])));
  }
  child.setEnabled(tabPane.isEnabled());
  child.setVisible(visible);
}

代码示例来源: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: joel-costigliola/assertj-swing

/**
 * Returns the {@code String} representation of the given {@code Component}, which should be a {@code JTabbedPane}.
 *
 * @param c the given {@code Component}.
 * @return the {@code String} representation of the given {@code JTabbedPane}.
 */
@Override
@Nonnull protected String doFormat(@Nonnull Component c) {
 JTabbedPane tabbedPane = (JTabbedPane) c;
 String format = "%s[name=%s, selectedTabIndex=%d, selectedTabTitle=%s, tabCount=%d, tabTitles=%s, enabled=%b, visible=%s, showing=%s";
 return String.format(format, getRealClassName(c), quote(tabbedPane.getName()),
            tabbedPane.getSelectedIndex(), selectedTab(tabbedPane), tabbedPane.getTabCount(),
            Arrays.format(tabTitles(tabbedPane)), tabbedPane.isEnabled(), tabbedPane.isVisible(),
            tabbedPane.isShowing());
}

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

@Override
public void mousePressed(MouseEvent e) {
  if (!tabPane.isEnabled()) {
    return;

代码示例来源: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.google.code.validationframework/validationframework-swing

/**
   * @see PropertyChangeListener#propertyChange(PropertyChangeEvent)
   */
  @Override
  public void propertyChange(PropertyChangeEvent evt) {
    if (tabbedPane != null) {
      if ("indexForTitle".equals(evt.getPropertyName())) {
        // Update text label with the new title set on the tabbed pane
        Component title = tabbedPane.getTabComponentAt(tabIndex);
        if (title instanceof TitleRenderer) {
          ((TitleRenderer) title).setTitle(tabbedPane.getTitleAt(tabIndex));
        }
      } else if ("enabled".equals(evt.getPropertyName())) {
        // Enable/disabled title renderer as well to make it look like enabled/disabled
        if (tabIndex < tabbedPane.getTabCount()) {
          Component title = tabbedPane.getTabComponentAt(tabIndex);
          if (title instanceof TitleRenderer) {
            title.setEnabled(tabbedPane.isEnabled() && tabbedPane.isEnabledAt(tabIndex));
          }
        }
      }
    }
  }
}

代码示例来源:origin: com.google.code.validationframework/validationframework-swing

/**
 * @see JPanel#paint(Graphics)
 * @see #paintTitleAsEnabled
 */
@Override
public void paint(Graphics g) {
  if (tabbedPane != null) {
    // Check if tab enabled state changed since last paint
    boolean tabEnabled = tabbedPane.isEnabled() && tabbedPane.isEnabledAt(tabIndex);
    if (tabEnabled == paintTitleAsEnabled) {
      // No change in tab enabled state since last time
      super.paint(g);
    } else {
      // Change in tab enabled state
      paintTitleAsEnabled = tabEnabled;
      if (paintTitleAsEnabled == isEnabled()) {
        super.paint(g);
      } else {
        setEnabled(paintTitleAsEnabled);
        // Will repaint later anyway
      }
    }
  }
}

代码示例来源:origin: khuxtable/seaglass

if (!tabPane.isEnabled()) {
  return;
if (!SwingUtilities.isLeftMouseButton(e) || !tabPane.isEnabled()) {
  return;

代码示例来源: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: khuxtable/seaglass

int state = 0;
if (!tabPane.isEnabled() || !tabPane.isEnabledAt(index)) {
  state |= SynthConstants.DISABLED;

代码示例来源:origin: UNIVALI-LITE/Portugol-Studio

if ( tabPane.isEnabled () && tabPane.isEnabledAt ( tabIndex ) )

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

if (tabPane.isEnabled() && tabPane.isEnabledAt(tabIndex))

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

if (tabPane.isEnabled() && tabPane.isEnabledAt(tabIndex)) {
  Color fg = tabPane.getForegroundAt(tabIndex);
  if (isSelected && (fg instanceof UIResource)) {

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

if (tabPane.isEnabled() && tabPane.isEnabledAt(tabIndex)) {
  if (isSelected ) {
    Color titleColor = AbstractLookAndFeel.getTabSelectionForegroundColor();

代码示例来源:origin: com.google.code.validationframework/validationframework-swing

customTitleRenderer.setEnabled(tabbedPane.isEnabled() && tabbedPane.isEnabledAt(tabIndex));
customTitleRenderer.setTitle(tabbedPane.getTitleAt(tabIndex));

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

if (tabPane.isEnabled() && tabPane.isEnabledAt(tabIndex)) {
  if (isSelected) {
    Color shadowColor = ColorHelper.darker(AbstractLookAndFeel.getWindowTitleColorDark(), 30);

代码示例来源:origin: com.google.code.validationframework/validationframework-swing

setOpaque(false);
paintTitleAsEnabled = tabbedPane.isEnabled() && tabbedPane.isEnabledAt(tabIndex);

相关文章

JTabbedPane类方法