本文整理汇总了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;
}