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

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

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

JTabbedPane.getTabPlacement介绍

暂无

代码示例

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

/**
   * {@inheritDoc}
   */
  public boolean isInState(JComponent c) {
    return (c instanceof JTabbedPane && ((JTabbedPane) c).getTabPlacement() == JTabbedPane.RIGHT);
  }
}

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

/**
   * {@inheritDoc}
   */
  public boolean isInState(JComponent c) {
    return (c instanceof JTabbedPane && ((JTabbedPane) c).getTabPlacement() == JTabbedPane.LEFT);
  }
}

代码示例来源:origin: net.java.dev.swing-layout/swing-layout

private static int getTabbedPaneBaselineResizeBehavior(JTabbedPane tp) {
  switch(tp.getTabPlacement()) {
  case JTabbedPane.LEFT:
  case JTabbedPane.RIGHT:
  case JTabbedPane.TOP:
    return BRB_CONSTANT_ASCENT;
  case JTabbedPane.BOTTOM:
    return BRB_CONSTANT_DESCENT;
  }
  return BRB_OTHER;
}

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

/**
   * {@inheritDoc}
   */
  public boolean isInState(JComponent c) {
    return (c instanceof JTabbedPane && ((JTabbedPane) c).getTabPlacement() == JTabbedPane.TOP);
  }
}

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

/**
   * {@inheritDoc}
   */
  public boolean isInState(JComponent c) {
    return (c instanceof JTabbedPane && ((JTabbedPane) c).getTabPlacement() == JTabbedPane.BOTTOM);
  }
}

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

public void paintComponent(Graphics g)
  {
    super.paintComponent(g);
    TabbedPaneUI.this.paintTabArea(
      g,
      tabPane.getTabPlacement(),
      tabPane.getSelectedIndex());
  }
}

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

public void paintComponent(Graphics g) {
  super.paintComponent(g);
  paintScrollContentBorder(g, tabPane.getTabPlacement(), tabPane.getSelectedIndex(), 0, 0, getWidth(), getHeight());
  paintTabArea(g, tabPane.getTabPlacement(), tabPane.getSelectedIndex());
}

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

protected Color[] getTabColors(int tabIndex, boolean isSelected, boolean isRollover) {
  Color backColor = tabPane.getBackgroundAt(tabIndex);
  if ((backColor instanceof UIResource) && isSelected) {
    if (tabPane.getTabPlacement() == BOTTOM) {
      return BOTTOM_SELECTED_TAB_COLORS;
    } else {
      return TOP_SELECTED_TAB_COLORS;
    }
  }
  return super.getTabColors(tabIndex, isSelected, isRollover);
}

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

public void actionPerformed(ActionEvent e) {
    JTabbedPane pane = (JTabbedPane) e.getSource();
    BaseTabbedPaneUI ui = (BaseTabbedPaneUI) pane.getUI();
    int tabPlacement = pane.getTabPlacement();
    if (tabPlacement == TOP || tabPlacement == BOTTOM) {
      ui.navigateSelectedTab(WEST);
    } else {
      ui.navigateSelectedTab(NORTH);
    }
  }
};

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

/**
 * @see com.seaglasslookandfeel.painter.AbstractRegionPainter#doPaint(java.awt.Graphics2D,
 *      javax.swing.JComponent, int, int, java.lang.Object[])
 */
protected void doPaint(Graphics2D g, JComponent c, int width, int height, Object[] extendedCacheKeys) {
  JTabbedPane tabPane     = (JTabbedPane) c;
  int         orientation = tabPane.getTabPlacement();
  if (orientation == JTabbedPane.LEFT || orientation == JTabbedPane.RIGHT) {
    paintVerticalLine(g, c, 0, height / 2, width, height);
  } else {
    paintHorizontalLine(g, c, 0, height / 2, width, height);
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

public void actionPerformed(ActionEvent e) {
    JTabbedPane pane = (JTabbedPane) e.getSource();
    BasicJideTabbedPaneUI ui = (BasicJideTabbedPaneUI) pane.getUI();
    int tabPlacement = pane.getTabPlacement();
    if (tabPlacement == TOP || tabPlacement == BOTTOM) {
      ui.navigateSelectedTab(WEST);
    }
    else {
      ui.navigateSelectedTab(NORTH);
    }
  }
}

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

public void actionPerformed(ActionEvent e) {
    JTabbedPane pane = (JTabbedPane) e.getSource();
    BaseTabbedPaneUI ui = (BaseTabbedPaneUI) pane.getUI();
    int tabPlacement = pane.getTabPlacement();
    if (tabPlacement == TOP || tabPlacement == BOTTOM) {
      ui.navigateSelectedTab(EAST);
    } else {
      ui.navigateSelectedTab(SOUTH);
    }
  }
};

代码示例来源:origin: com.jidesoft/jide-oss

public void actionPerformed(ActionEvent e) {
    JTabbedPane pane = (JTabbedPane) e.getSource();
    BasicJideTabbedPaneUI ui = (BasicJideTabbedPaneUI) pane.getUI();
    int tabPlacement = pane.getTabPlacement();
    if (tabPlacement == TOP || tabPlacement == BOTTOM) {
      ui.navigateSelectedTab(EAST);
    }
    else {
      ui.navigateSelectedTab(SOUTH);
    }
  }
}

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

public void actionPerformed(ActionEvent e)
  {
    JTabbedPane pane= (JTabbedPane) e.getSource();
    TabbedPaneUI ui= (TabbedPaneUI) pane.getUI();
    int tabPlacement= pane.getTabPlacement();
    if (tabPlacement == TOP || tabPlacement == BOTTOM)
    {
      ui.navigateSelectedTab(WEST);
    }
    else
    {
      ui.navigateSelectedTab(NORTH);
    }
  }
};

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

public void calculateLayoutInfo()
{
  int tabCount= tabPane.getTabCount();
  assureRectsCreated(tabCount);
  calculateTabRects(tabPane.getTabPlacement(), tabCount);
}

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

public void calculateLayoutInfo() {
  int tc = tabPane.getTabCount();
  assureRectsCreated(tc);
  calculateTabRects(tabPane.getTabPlacement(), tc);
}

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

public void actionPerformed(ActionEvent e) {
    JTabbedPane pane;
    Object src = e.getSource();
    if (src instanceof JTabbedPane) {
      pane = (JTabbedPane) src;
    } else if (src instanceof ScrollableTabButton) {
      pane = (JTabbedPane) ((ScrollableTabButton) src).getParent();
    } else {
      return; // shouldn't happen
    }
    BaseTabbedPaneUI ui = (BaseTabbedPaneUI) pane.getUI();
    if (ui.scrollableTabLayoutEnabled()) {
      ui.tabScroller.scrollBackward(pane.getTabPlacement());
    }
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

public void actionPerformed(ActionEvent e) {
    JTabbedPane pane = null;
    Object src = e.getSource();
    if (src instanceof JTabbedPane) {
      pane = (JTabbedPane) src;
    }
    else if (src instanceof JideTabbedPane.NoFocusButton) {
      pane = (JTabbedPane) SwingUtilities.getAncestorOfClass(JTabbedPane.class, (JideTabbedPane.NoFocusButton) src);
    }
    if (pane != null) {
      BasicJideTabbedPaneUI ui = (BasicJideTabbedPaneUI) pane.getUI();
      if (ui.scrollableTabLayoutEnabled()) {
        ui._tabScroller.scrollBackward(pane.getTabPlacement());
      }
    }
  }
}

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

private int getTargetTabIndex(Point point) {
  Point tabPt = SwingUtilities.convertPoint(pane, point, pane);
  boolean isTB = pane.getTabPlacement()==JTabbedPane.TOP || pane.getTabPlacement()==JTabbedPane.BOTTOM;
  for(int i=0;i < getTabCount();i++) {
    Rectangle r = pane.getBoundsAt(i);
    if(isTB) r.setRect(r.x-r.width/2, r.y,  r.width, r.height);
    else   r.setRect(r.x, r.y-r.height/2, r.width, r.height);
      if(r.contains(tabPt)) return i;
  }
  Rectangle r = pane.getBoundsAt(getTabCount()-1);
  if(isTB) r.setRect(r.x+r.width/2, r.y,  r.width, r.height);
  else   r.setRect(r.x, r.y+r.height/2, r.width, r.height);
  return   r.contains(tabPt)?getTabCount():-1;
}

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

public void stateChanged(ChangeEvent e) {
    JTabbedPane tabPane = (JTabbedPane) e.getSource();
    if (JTattooUtilities.getJavaVersion() >= 1.4) {
      if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT) {
        int index = tabPane.getSelectedIndex();
        if (index >= 0) {
          BaseTabbedPaneUI ui = (BaseTabbedPaneUI) tabPane.getUI();
          ui.tabScroller.scrollTabToVisible(tabPane.getTabPlacement(), index);
        }
      }
    }
    tabPane.revalidate();
    tabPane.repaint();
  }
}

相关文章

JTabbedPane类方法