本文整理匯總了Java中java.awt.Container.getBounds方法的典型用法代碼示例。如果您正苦於以下問題:Java Container.getBounds方法的具體用法?Java Container.getBounds怎麽用?Java Container.getBounds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.Container
的用法示例。
在下文中一共展示了Container.getBounds方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: scrollRectToVisible
import java.awt.Container; //導入方法依賴的package包/類
@Override
public void scrollRectToVisible(Rectangle contentRect) {
Container parent;
int dx = getX(), dy = getY();
for (parent = getParent();
!(parent == null) &&
!(parent instanceof JComponent) &&
!(parent instanceof CellRendererPane);
parent = parent.getParent()) {
Rectangle bounds = parent.getBounds();
dx += bounds.x;
dy += bounds.y;
}
if (!(parent == null) && !(parent instanceof CellRendererPane)) {
contentRect.x += dx;
contentRect.y += dy;
((JComponent) parent).scrollRectToVisible(contentRect);
contentRect.x -= dx;
contentRect.y -= dy;
}
}
示例2: layoutContainer
import java.awt.Container; //導入方法依賴的package包/類
public void layoutContainer(Container c) {
Rectangle b = c.getBounds();
int topHeight = 90;
int inset = 4;
showConnectionInfoButton.setBounds(b.width - 2 * inset - 120, inset, 120,
25);
fetchButton.setBounds(b.width - 2 * inset - 120, 60, 120, 25);
// queryLabel.setBounds(10, 10, 100, 25);
queryAggregate.setBounds(inset, inset, b.width - 2 * inset - 150, 80);
tableAggregate.setBounds(new Rectangle(inset,
inset + topHeight,
b.width - 2 * inset,
b.height - 2 * inset - topHeight));
}