本文整理汇总了Java中java.awt.BorderLayout.SOUTH属性的典型用法代码示例。如果您正苦于以下问题:Java BorderLayout.SOUTH属性的具体用法?Java BorderLayout.SOUTH怎么用?Java BorderLayout.SOUTH使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.BorderLayout
的用法示例。
在下文中一共展示了BorderLayout.SOUTH属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: createDialog
public Dialog createDialog( String title, JPanel panel, boolean modal,
JButton[] buttons, boolean sidebuttons, int defaultIndex,
int cancelIndex, ActionListener listener ) {
// create the dialog with given content
JDialog d = new JDialog( (javax.swing.JFrame)null, title, modal );
d.setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE );
d.getContentPane().add( panel, BorderLayout.CENTER);
// Add the buttons to it
JPanel buttonPanel = createButtonPanel( buttons, sidebuttons );
String buttonAlign = sidebuttons ? BorderLayout.EAST : BorderLayout.SOUTH;
d.getContentPane().add( buttonPanel, buttonAlign );
// add listener to buttons
if( listener != null ) {
for( int i = 0; i < buttons.length; i++ ) {
buttons[i].addActionListener( listener );
}
}
// register the default button, if available
if( defaultIndex >= 0 ) {
d.getRootPane().setDefaultButton( buttons[defaultIndex] );
}
// register the cancel button helpers, if available
if( cancelIndex >= 0 ) {
cancelButton = buttons[cancelIndex];
// redirect the Esc key to Cancel button
d.getRootPane().registerKeyboardAction(
this,
KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, true),
JComponent.WHEN_IN_FOCUSED_WINDOW
);
// listen on windowClosing and redirect it to Cancel button
d.addWindowListener( this );
}
d.pack();
return d;
}
示例3: getDefaultPosition
@Override
public String getDefaultPosition() {
return BorderLayout.SOUTH;
}