本文整理汇总了Java中org.netbeans.swing.tabcontrol.TabDisplayer.ORIENTATION_EAST属性的典型用法代码示例。如果您正苦于以下问题:Java TabDisplayer.ORIENTATION_EAST属性的具体用法?Java TabDisplayer.ORIENTATION_EAST怎么用?Java TabDisplayer.ORIENTATION_EAST使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.netbeans.swing.tabcontrol.TabDisplayer
的用法示例。
在下文中一共展示了TabDisplayer.ORIENTATION_EAST属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: boundsFor
private void boundsFor (IndexButton b, Rectangle r) {
Object orientation = getDisplayerOrientation();
boolean flip = orientation == TabDisplayer.ORIENTATION_EAST ||
orientation == TabDisplayer.ORIENTATION_WEST;
int index = b.getIndex();
if (index >= displayer.getModel().size() || index < 0) {
r.setBounds (-20, -20, 0, 0);
return;
}
r.x = layoutModel.getX(index);
r.y = layoutModel.getY(index);
r.width = layoutModel.getW(index);
r.height = layoutModel.getH(index);
if (flip) {
int tmp = r.x;
r.x = r.y;
r.y = tmp;
tmp = r.width;
r.width = r.height;
r.height = tmp;
}
}
示例2: preferredLayoutSize
@Override
public Dimension preferredLayoutSize(Container parent) {
Object orientation = getDisplayerOrientation();
boolean flip = orientation == TabDisplayer.ORIENTATION_EAST ||
orientation == TabDisplayer.ORIENTATION_WEST;
int max = displayer.getModel().size();
Dimension result = new Dimension();
for (int i=0; i < max; i++) {
result.height = Math.max (result.height, layoutModel.getH(i));
result.width += layoutModel.getW(i);
}
if (flip) {
int tmp = result.height;
result.height = result.width;
result.width = tmp;
}
return result;
}
示例3: paint
/** Provides the painting logic. Note that this does not call any of the
* painting methods of BasicToggleButtonUI */
@Override
public final void paint(Graphics g, JComponent c) {
BasicSlidingTabDisplayerUI.IndexButton b =
(BasicSlidingTabDisplayerUI.IndexButton) c;
Graphics2D g2d = (Graphics2D) g;
paintBackground (g2d, b);
Object orientation = b.getOrientation();
AffineTransform tr = g2d.getTransform();
if (orientation == TabDisplayer.ORIENTATION_EAST) {
g2d.rotate( Math.PI / 2 );
g2d.translate( 0, - c.getWidth() );
} else if (orientation == TabDisplayer.ORIENTATION_WEST) {
g2d.rotate(-Math.PI / 2);
g2d.translate(-c.getHeight(), 0);
}
paintIconAndText (g2d, b, orientation);
g2d.setTransform (tr);
}
示例4: initSize
private void initSize() {
d = comp.getPreferredSize();
Dimension d2 = contentDisplayer.getSize();
d.width = Math.max (d2.width, d.width);
d.height = Math.max (d2.height, d.height);
boolean flip = orientation == TabDisplayer.ORIENTATION_EAST ||
orientation == TabDisplayer.ORIENTATION_WEST;
if (d.width == 0 || d.height == 0) {
if (flip) {
d.width = root.getWidth();
d.height = tabDisplayer.getHeight();
} else {
d.width = tabDisplayer.getWidth();
d.height = root.getHeight();
}
} else {
if (flip) {
d.height = Math.max (d.height, tabDisplayer.getHeight());
} else {
d.width = Math.max (d.width, tabDisplayer.getWidth());
}
}
}
示例5: getImageBounds
private Rectangle getImageBounds() {
if (!changed) {
return rect;
}
Component c = tabDisplayer;
r2.setBounds (0, 0, c.getWidth(), c.getHeight());
Rectangle dispBounds = SwingUtilities.convertRectangle(c, r2,
this);
if (orientation == TabDisplayer.ORIENTATION_WEST) {
rect.x = dispBounds.x + dispBounds.width;
rect.y = dispBounds.y;
rect.width = Math.round (inc * d.width);
rect.height = dispBounds.height;
} else if (orientation == TabDisplayer.ORIENTATION_EAST) {
rect.width = Math.round (inc * d.width);
rect.height = dispBounds.height;
rect.x = dispBounds.x - rect.width;
rect.y = dispBounds.y;
} else if (orientation == TabDisplayer.ORIENTATION_SOUTH) {
rect.width = dispBounds.width;
rect.height = Math.round(inc * d.height);
rect.x = dispBounds.x;
rect.y = dispBounds.y - rect.height;
} else if (orientation == TabDisplayer.ORIENTATION_NORTH) {
rect.x = dispBounds.x;
rect.y = dispBounds.y + dispBounds.height;
rect.width = dispBounds.width;
rect.height = Math.round(inc * d.height);
}
changed = false;
return rect;
}
示例6: dropIndexOfPoint
@Override
public int dropIndexOfPoint(Point p) {
Point p2 = toDropPoint(p);
int start = getFirstVisibleTab();
int end = getLastVisibleTab();
int target;
for (target = start; target <= end; target ++) {
getTabRect (target, scratch);
if (scratch.contains(p2)) {
if (target == end) {
Object orientation = displayer.getClientProperty (TabDisplayer.PROP_ORIENTATION);
boolean flip = displayer.getType() == TabDisplayer.TYPE_SLIDING && (
orientation == TabDisplayer.ORIENTATION_EAST ||
orientation == TabDisplayer.ORIENTATION_WEST);
if (flip) {
if (p2.y > scratch.y + (scratch.height / 2)) {
return target+1;
}
} else {
if (p2.x > scratch.x + (scratch.width / 2)) {
return target+1;
}
}
}
return target;
}
}
return -1;
}
示例7: updateOrientation
/** Checks the position of the tabbed container relative to its parent
* window, and potentially updates its orientation client property.
*
* @see TabDisplayer#PROP_ORIENTATION
*/
protected final void updateOrientation() {
if (!container.isDisplayable()) {
return;
}
if (Boolean.FALSE.equals(container.getClientProperty (TabbedContainer.PROP_MANAGE_TAB_POSITION))) {
//The client has specified that it does not want automatic management
//of the displayer orientation
return;
}
Object currOrientation = tabDisplayer.getClientProperty(TabDisplayer.PROP_ORIENTATION);
Container window = container.getTopLevelAncestor();
Rectangle containerBounds = container.getBounds();
containerBounds = SwingUtilities.convertRectangle(container, containerBounds, window);
boolean longestIsVertical = containerBounds.width < containerBounds.height;
int distanceToLeft = containerBounds.x;
int distanceToTop = containerBounds.y;
int distanceToRight = window.getWidth() - (containerBounds.x + containerBounds.width);
int distanceToBottom = window.getHeight() - (containerBounds.y + containerBounds.height);
Object orientation;
if (!longestIsVertical) {
if (distanceToBottom > distanceToTop) {
orientation = TabDisplayer.ORIENTATION_NORTH;
} else {
orientation = TabDisplayer.ORIENTATION_SOUTH;
}
} else {
if (distanceToLeft > distanceToRight) {
orientation = TabDisplayer.ORIENTATION_EAST;
} else {
orientation = TabDisplayer.ORIENTATION_WEST;
}
}
if (currOrientation != orientation) {
tabDisplayer.putClientProperty(
TabDisplayer.PROP_ORIENTATION, orientation);
container.validate();
}
}
示例8: layoutContainer
public void layoutContainer(Container parent) {
JComponent c = tabDisplayer;
Object orientation = c.getClientProperty (
TabDisplayer.PROP_ORIENTATION);
Dimension d = tabDisplayer.getPreferredSize();
Insets ins = container.getInsets();
int width = parent.getWidth() - (ins.left + ins.right);
int height = parent.getHeight() - (ins.top + ins.bottom);
if (orientation == TabDisplayer.ORIENTATION_NORTH) {
c.setBounds (ins.left, ins.top,
width, d.height);
contentDisplayer.setBounds (ins.left, ins.top + d.height,
width,
parent.getHeight() - (d.height + ins.top + ins.bottom));
} else if (orientation == TabDisplayer.ORIENTATION_SOUTH) {
contentDisplayer.setBounds (ins.top, ins.left, width,
parent.getHeight() - (d.height + ins.top + ins.bottom));
c.setBounds (ins.left, parent.getHeight() - (d.height + ins.top + ins.bottom),
width, d.height);
} else if (orientation == TabDisplayer.ORIENTATION_EAST) {
contentDisplayer.setBounds (ins.left, ins.top, width - d.width,
height);
c.setBounds (parent.getWidth() - (ins.right + d.width), ins.top,
d.width, height);
} else if (orientation == TabDisplayer.ORIENTATION_WEST) {
c.setBounds (ins.left, ins.top, d.width, height);
contentDisplayer.setBounds (ins.left + d.width, ins.top,
width - d.width, height);
} else {
throw new IllegalArgumentException ("Unknown orientation: " + orientation);
}
}
示例9: paintIconAndText
/** Paints the icon and text using the HTML mini renderer */
protected final void paintIconAndText (Graphics2D g, BasicSlidingTabDisplayerUI.IndexButton b, Object orientation) {
FontMetrics fm = g.getFontMetrics(b.getFont());
Insets ins = b.getInsets();
boolean flip = orientation == TabDisplayer.ORIENTATION_EAST ||
orientation == TabDisplayer.ORIENTATION_WEST;
int txtX = flip ? ins.top : ins.left;
int txtY = orientation == TabDisplayer.ORIENTATION_EAST ? ins.right :
orientation == TabDisplayer.ORIENTATION_WEST ? ins.left : ins.top;
int txtW = flip ? b.getHeight() - (ins.top + ins.bottom):
b.getWidth() - (ins.left + ins.right);
int iconX = txtX;
int iconY = txtY;
int txtH = fm.getHeight();
txtY += fm.getMaxAscent();
Icon icon = b.getIcon();
int iconH = icon.getIconHeight();
int iconW = icon.getIconWidth();
int workingHeight;
if (flip) {
workingHeight = b.getWidth() - (ins.left + ins.right);
} else {
workingHeight = b.getHeight() - (ins.top + ins.bottom);
}
txtY += (workingHeight / 2) - (txtH / 2);
iconY += (workingHeight / 2) - (iconH / 2);
if (icon != null && iconW > 0 && iconH > 0) {
txtX += iconW + b.getIconTextGap();
icon.paintIcon (b, g, iconX, iconY);
txtW -= iconH + b.getIconTextGap();
}
HtmlRenderer.renderString(b.getText(), g, txtX, txtY, txtW, txtH, b.getFont(),
b.getForeground(), HtmlRenderer.STYLE_TRUNCATE, true);
}