本文整理匯總了Java中java.awt.Label.RIGHT屬性的典型用法代碼示例。如果您正苦於以下問題:Java Label.RIGHT屬性的具體用法?Java Label.RIGHT怎麽用?Java Label.RIGHT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.awt.Label
的用法示例。
在下文中一共展示了Label.RIGHT屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setAlignment
/**
* Sets the horizontal alignment of the label. This is implemented to
* set the alignment on the Swing label.
*
* @param alignment the horizontal alignment
*
* @see Label#LEFT
* @see Label#RIGHT
* @see Label#CENTER
*/
public void setAlignment(int alignment)
{
JLabel swingLabel = (JLabel) swingComponent.getJComponent();
switch (alignment)
{
case Label.RIGHT:
swingLabel.setHorizontalAlignment(JLabel.RIGHT);
break;
case Label.CENTER:
swingLabel.setHorizontalAlignment(JLabel.CENTER);
break;
case Label.LEFT:
default:
swingLabel.setHorizontalAlignment(JLabel.LEFT);
break;
}
}
示例2: convertAlignment
/**
* Converts {@code Label} alignment constant to the {@code JLabel} constant.
* If wrong Label alignment provided returns default alignment.
*
* @param alignment {@code Label} constant.
*
* @return {@code JLabel} constant.
*/
private static int convertAlignment(final int alignment) {
switch (alignment) {
case Label.CENTER:
return SwingConstants.CENTER;
case Label.RIGHT:
return SwingConstants.RIGHT;
default:
return SwingConstants.LEFT;
}
}
示例3: getGtkAlignment
float getGtkAlignment (int alignment)
{
switch (alignment)
{
case Label.LEFT:
return 0.0f;
case Label.CENTER:
return 0.5f;
case Label.RIGHT:
return 1.0f;
}
return 0.0f;
}