Java Code Examples for java.awt.Component#CENTER_ALIGNMENT

The following examples show how to use java.awt.Component#CENTER_ALIGNMENT . 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 File: FormUtils.java    From jdal with 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 File: Toolbar.java    From gcs with Mozilla Public License 2.0 4 votes vote down vote up
@Override
public float getLayoutAlignmentX(Container target) {
    return Component.CENTER_ALIGNMENT;
}
 
Example 3
Source File: Toolbar.java    From gcs with Mozilla Public License 2.0 4 votes vote down vote up
@Override
public float getLayoutAlignmentY(Container target) {
    return Component.CENTER_ALIGNMENT;
}
 
Example 4
Source File: ColumnLayout.java    From gcs with Mozilla Public License 2.0 4 votes vote down vote up
@Override
public float getLayoutAlignmentX(Container target) {
    return Component.CENTER_ALIGNMENT;
}
 
Example 5
Source File: ColumnLayout.java    From gcs with Mozilla Public License 2.0 4 votes vote down vote up
@Override
public float getLayoutAlignmentY(Container target) {
    return Component.CENTER_ALIGNMENT;
}
 
Example 6
Source File: FlexLayout.java    From gcs with Mozilla Public License 2.0 4 votes vote down vote up
@Override
public float getLayoutAlignmentX(Container target) {
    return Component.CENTER_ALIGNMENT;
}
 
Example 7
Source File: FlexLayout.java    From gcs with Mozilla Public License 2.0 4 votes vote down vote up
@Override
public float getLayoutAlignmentY(Container target) {
    return Component.CENTER_ALIGNMENT;
}
 
Example 8
Source File: PrecisionLayout.java    From gcs with Mozilla Public License 2.0 4 votes vote down vote up
@Override
public float getLayoutAlignmentX(Container target) {
    return Component.CENTER_ALIGNMENT;
}
 
Example 9
Source File: PrecisionLayout.java    From gcs with Mozilla Public License 2.0 4 votes vote down vote up
@Override
public float getLayoutAlignmentY(Container target) {
    return Component.CENTER_ALIGNMENT;
}