Java Code Examples for java.awt.Component#CENTER_ALIGNMENT

The following examples show how to use java.awt.Component#CENTER_ALIGNMENT . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: jdal   File: FormUtils.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Create a box with an aligned component using Component constants for right, center and left.
 * @param c component
 * @param alignment aligment.
 * @return Box with compoenent
 */
public static Component newBoxForComponent(Component c, float alignment) {
	Box box = Box.createHorizontalBox();
	if (Component.RIGHT_ALIGNMENT == alignment) {
		box.add(Box.createHorizontalGlue());
		box.add(c);
	}
	else if (Component.CENTER_ALIGNMENT == alignment) {
		box.add(Box.createHorizontalGlue());
		box.add(c);
		box.add(Box.createHorizontalGlue());
	}
	else { 
		// default to left
		box.add(c);
		box.add(Box.createHorizontalGlue());
	}
	
	return box;
}
 
Example 2
Source Project: gcs   File: Toolbar.java    License: Mozilla Public License 2.0 4 votes vote down vote up
@Override
public float getLayoutAlignmentX(Container target) {
    return Component.CENTER_ALIGNMENT;
}
 
Example 3
Source Project: gcs   File: Toolbar.java    License: Mozilla Public License 2.0 4 votes vote down vote up
@Override
public float getLayoutAlignmentY(Container target) {
    return Component.CENTER_ALIGNMENT;
}
 
Example 4
Source Project: gcs   File: ColumnLayout.java    License: Mozilla Public License 2.0 4 votes vote down vote up
@Override
public float getLayoutAlignmentX(Container target) {
    return Component.CENTER_ALIGNMENT;
}
 
Example 5
Source Project: gcs   File: ColumnLayout.java    License: Mozilla Public License 2.0 4 votes vote down vote up
@Override
public float getLayoutAlignmentY(Container target) {
    return Component.CENTER_ALIGNMENT;
}
 
Example 6
Source Project: gcs   File: FlexLayout.java    License: Mozilla Public License 2.0 4 votes vote down vote up
@Override
public float getLayoutAlignmentX(Container target) {
    return Component.CENTER_ALIGNMENT;
}
 
Example 7
Source Project: gcs   File: FlexLayout.java    License: Mozilla Public License 2.0 4 votes vote down vote up
@Override
public float getLayoutAlignmentY(Container target) {
    return Component.CENTER_ALIGNMENT;
}
 
Example 8
Source Project: gcs   File: PrecisionLayout.java    License: Mozilla Public License 2.0 4 votes vote down vote up
@Override
public float getLayoutAlignmentX(Container target) {
    return Component.CENTER_ALIGNMENT;
}
 
Example 9
Source Project: gcs   File: PrecisionLayout.java    License: Mozilla Public License 2.0 4 votes vote down vote up
@Override
public float getLayoutAlignmentY(Container target) {
    return Component.CENTER_ALIGNMENT;
}