本文整理匯總了Java中java.awt.BorderLayout.WEST屬性的典型用法代碼示例。如果您正苦於以下問題:Java BorderLayout.WEST屬性的具體用法?Java BorderLayout.WEST怎麽用?Java BorderLayout.WEST使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.awt.BorderLayout
的用法示例。
在下文中一共展示了BorderLayout.WEST屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: placeToolbar
private void placeToolbar() {
String loc = AppPreferences.TOOLBAR_PLACEMENT.get();
Container contents = getContentPane();
contents.remove(toolbar);
mainPanelSuper.remove(toolbar);
if (AppPreferences.TOOLBAR_HIDDEN.equals(loc)) {
; // don't place value anywhere
} else if (AppPreferences.TOOLBAR_DOWN_MIDDLE.equals(loc)) {
toolbar.setOrientation(Toolbar.VERTICAL);
mainPanelSuper.add(toolbar, BorderLayout.WEST);
} else { // it is a BorderLayout constant
Object value = BorderLayout.NORTH;
for (Direction dir : Direction.cardinals) {
if (dir.toString().equals(loc)) {
if (dir == Direction.EAST)
value = BorderLayout.EAST;
else if (dir == Direction.SOUTH)
value = BorderLayout.SOUTH;
else if (dir == Direction.WEST)
value = BorderLayout.WEST;
else
value = BorderLayout.NORTH;
}
}
contents.add(toolbar, value);
boolean vertical = value == BorderLayout.WEST || value == BorderLayout.EAST;
toolbar.setOrientation(vertical ? Toolbar.VERTICAL : Toolbar.HORIZONTAL);
}
contents.validate();
}
示例2: getDefaultPosition
@Override
public String getDefaultPosition() {
return BorderLayout.WEST;
}