本文整理了Java中javax.swing.JTabbedPane.getComponentOrientation()
方法的一些代码示例,展示了JTabbedPane.getComponentOrientation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTabbedPane.getComponentOrientation()
方法的具体详情如下:
包路径:javax.swing.JTabbedPane
类名称:JTabbedPane
方法名:getComponentOrientation
暂无
代码示例来源:origin: khuxtable/seaglass
/**
* Return {@code true} if the tab close button should be placed on the left,
* {@code false} otherwise.
*
* @return {@code true} if the tab close button should be placed on the
* left, {@code false} otherwise.
*/
private boolean isCloseButtonOnLeft() {
return (tabCloseButtonPlacement == LEFT) == tabPane.getComponentOrientation().isLeftToRight();
}
代码示例来源:origin: com.github.insubstantial/substance
/**
* Retrieves the close button rectangle for drawing purposes.
*
* @param tabIndex
* Tab index.
* @param x
* X coordinate of the tab.
* @param y
* Y coordinate of the tab.
* @param width
* The tab width.
* @param height
* The tab height.
* @return The close button rectangle.
*/
protected Rectangle getCloseButtonRectangleForDraw(int tabIndex, int x,
int y, int width, int height) {
int dimension = SubstanceCoreUtilities.getCloseButtonSize(this.tabPane,
tabIndex);
int borderDelta = (int) Math.ceil(3.0 * SubstanceSizeUtils
.getBorderStrokeWidth(SubstanceSizeUtils
.getComponentFontSize(this.tabPane)));
int xs = this.tabPane.getComponentOrientation().isLeftToRight() ? (x
+ width - dimension - borderDelta) : (x + borderDelta);
int ys = y + (height - dimension) / 2 + 1;
return new Rectangle(xs, ys, dimension, dimension);
}
代码示例来源:origin: org.java.net.substance/substance
/**
* Retrieves the close button rectangle for drawing purposes.
*
* @param tabIndex
* Tab index.
* @param x
* X coordinate of the tab.
* @param y
* Y coordinate of the tab.
* @param width
* The tab width.
* @param height
* The tab height.
* @return The close button rectangle.
*/
protected Rectangle getCloseButtonRectangleForDraw(int tabIndex, int x,
int y, int width, int height) {
int dimension = SubstanceCoreUtilities.getCloseButtonSize(this.tabPane,
tabIndex);
int borderDelta = (int) Math.ceil(3.0 * SubstanceSizeUtils
.getBorderStrokeWidth(SubstanceSizeUtils
.getComponentFontSize(this.tabPane)));
int xs = this.tabPane.getComponentOrientation().isLeftToRight() ? (x
+ width - dimension - borderDelta) : (x + borderDelta);
int ys = y + (height - dimension) / 2 + 1;
return new Rectangle(xs, ys, dimension, dimension);
}
代码示例来源:origin: com.github.insubstantial/substance
@Override
protected int getTabLabelShiftX(int tabPlacement, int tabIndex,
boolean isSelected) {
int delta = 0;
if (SubstanceCoreUtilities.hasCloseButton(this.tabPane, tabIndex)) {
if (this.tabPane.getComponentOrientation().isLeftToRight()) {
delta = 5 - SubstanceCoreUtilities.getCloseButtonSize(
this.tabPane, tabIndex);
} else {
delta = SubstanceCoreUtilities.getCloseButtonSize(this.tabPane,
tabIndex) - 5;
}
}
return delta
+ super.getTabLabelShiftX(tabPlacement, tabIndex, isSelected);
}
代码示例来源:origin: org.java.net.substance/substance
@Override
protected int getTabLabelShiftX(int tabPlacement, int tabIndex,
boolean isSelected) {
int delta = 0;
if (SubstanceCoreUtilities.hasCloseButton(this.tabPane, tabIndex)) {
if (this.tabPane.getComponentOrientation().isLeftToRight()) {
delta = 5 - SubstanceCoreUtilities.getCloseButtonSize(
this.tabPane, tabIndex);
} else {
delta = SubstanceCoreUtilities.getCloseButtonSize(this.tabPane,
tabIndex) - 5;
}
}
return delta
+ super.getTabLabelShiftX(tabPlacement, tabIndex, isSelected);
}
代码示例来源:origin: com.fifesoft.rtext/fife.common
boolean leftToRight = tabPane.getComponentOrientation().isLeftToRight();
代码示例来源:origin: net.java.dev.laf-widget/laf-widget
boolean ltr = tabPane.getComponentOrientation().isLeftToRight();
if (ltr) {
if (tabPane.getTabPlacement() != SwingConstants.BOTTOM) {
代码示例来源:origin: net.java.dev.laf-widget/laf-widget
/**
* Creates a new tab overview button.
*
* @param tabPane
* The owner tabbed pane.
*/
public TabOverviewButton(final JTabbedPane tabPane) {
this.setFocusable(false);
LafWidgetSupport support = LafWidgetRepository.getRepository()
.getLafSupport();
if (support != null) {
Icon searchIcon = support.getSearchIcon(LafWidgetRepository
.getRepository().getLafSupport().getLookupIconSize(),
tabPane.getComponentOrientation());
this.setIcon(searchIcon);
support.markButtonAsFlat(this);
}
this.setToolTipText(LafWidgetUtilities.getResourceBundle(tabPane).getString(
"TabbedPane.overviewButtonTooltip"));
this.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
TabOverviewDialog.getOverviewDialog(tabPane).setVisible(true);
}
});
}
代码示例来源:origin: net.java.dev.laf-widget/laf-widget
if (tabbedPane.getComponentOrientation().isLeftToRight())
this.setBounds(2, tabAreaInsets.top, buttonSize, buttonSize);
else
break;
case SwingConstants.BOTTOM:
if (tabbedPane.getComponentOrientation().isLeftToRight())
this.setBounds(2, tabbedPane.getBounds().height
- tabAreaInsets.bottom - buttonSize - 4, buttonSize,
代码示例来源:origin: khuxtable/seaglass
/**
* Set the directions of the arrows in the scroll buttons if necessary.
*/
private void setScrollButtonDirections() {
if (tabPlacement == LEFT || tabPlacement == RIGHT) {
if (scrollForwardButton.getDirection() != SOUTH) {
scrollForwardButton.setDirection(SOUTH);
}
if (scrollBackwardButton.getDirection() != NORTH) {
scrollBackwardButton.setDirection(NORTH);
}
} else if (tabPane.getComponentOrientation().isLeftToRight()) {
if (scrollForwardButton.getDirection() != EAST) {
scrollForwardButton.setDirection(EAST);
}
if (scrollBackwardButton.getDirection() != WEST) {
scrollBackwardButton.setDirection(WEST);
}
} else {
if (scrollForwardButton.getDirection() != WEST) {
scrollForwardButton.setDirection(WEST);
}
if (scrollBackwardButton.getDirection() != EAST) {
scrollBackwardButton.setDirection(EAST);
}
}
}
代码示例来源:origin: khuxtable/seaglass
if (!tabPane.getComponentOrientation().isLeftToRight() && orientation == ControlOrientation.HORIZONTAL) {
flipRightToLeft(tabCount, tabPane.getSize());
代码示例来源:origin: khuxtable/seaglass
JComponent b = ss.getComponent();
boolean flipSegments = (orientation == ControlOrientation.HORIZONTAL && !tabPane.getComponentOrientation().isLeftToRight());
String segmentPosition = "only";
代码示例来源:origin: khuxtable/seaglass
/**
* Paint the background for a tab scroll button.
*
* @param ss the tab subregion SynthContext.
* @param g the Graphics context.
* @param scrollButton the button to paint.
*/
protected void paintScrollButtonBackground(SeaGlassContext ss, Graphics g, JButton scrollButton) {
Rectangle tabRect = scrollButton.getBounds();
int x = tabRect.x;
int y = tabRect.y;
int height = tabRect.height;
int width = tabRect.width;
boolean flipSegments = (orientation == ControlOrientation.HORIZONTAL && !tabPane.getComponentOrientation().isLeftToRight());
SeaGlassLookAndFeel.updateSubregion(ss, g, tabRect);
tabPane.putClientProperty("JTabbedPane.Tab.segmentPosition",
((scrollButton == scrollBackwardButton) ^ flipSegments) ? "first" : "last");
int oldState = tabContext.getComponentState();
ButtonModel model = scrollButton.getModel();
int isPressed = model.isPressed() && model.isArmed() ? PRESSED : 0;
int buttonState = SeaGlassLookAndFeel.getComponentState(scrollButton) | isPressed;
tabContext.setComponentState(buttonState);
tabContext.getPainter().paintTabbedPaneTabBackground(tabContext, g, x, y, width, height, -1, tabPlacement);
tabContext.getPainter().paintTabbedPaneTabBorder(tabContext, g, x, y, width, height, -1, tabPlacement);
tabContext.setComponentState(oldState);
}
内容来源于网络,如有侵权,请联系作者删除!