本文整理汇总了Java中org.netbeans.swing.tabcontrol.TabDisplayer.ORIENTATION_NORTH属性的典型用法代码示例。如果您正苦于以下问题:Java TabDisplayer.ORIENTATION_NORTH属性的具体用法?Java TabDisplayer.ORIENTATION_NORTH怎么用?Java TabDisplayer.ORIENTATION_NORTH使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.netbeans.swing.tabcontrol.TabDisplayer
的用法示例。
在下文中一共展示了TabDisplayer.ORIENTATION_NORTH属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: minimumLayoutSize
public Dimension minimumLayoutSize(Container parent) {
JComponent c = tabDisplayer;
Object orientation = c.getClientProperty (
TabDisplayer.PROP_ORIENTATION);
Dimension tabSize = tabDisplayer.getPreferredSize();
Insets ins = container.getInsets();
Dimension result = new Dimension();
Dimension contentSize = contentDisplayer.getPreferredSize();
if (tabDisplayer.getSelectionModel().getSelectedIndex() == -1) {
contentSize.width = 0;
contentSize.height = 0;
}
if (orientation == TabDisplayer.ORIENTATION_NORTH || orientation == TabDisplayer.ORIENTATION_SOUTH) {
result.height = ins.top + ins.bottom + contentSize.height + tabSize.height;
result.width = ins.left + ins.right + Math.max (contentSize.width, tabSize.width);
} else {
result.width = ins.left + ins.right + contentSize.width + tabSize.width;
result.height = ins.top + ins.bottom + Math.max (contentSize.height, tabSize.height);
}
return result;
}
示例2: 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;
}
示例3: 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();
}
}
示例4: 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);
}
}