本文整理了Java中org.eclipse.swt.widgets.Label.setAlignment()
方法的一些代码示例,展示了Label.setAlignment()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Label.setAlignment()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Label
类名称:Label
方法名:setAlignment
[英]Controls how text and images will be displayed in the receiver. The argument should be one of LEFT
, RIGHT
or CENTER
. If the receiver is a SEPARATOR
label, the argument is ignored and the alignment is not changed.
[中]控制文本和图像在接收器中的显示方式。参数应该是LEFT
、RIGHT
或CENTER
中的一个。如果接收器是SEPARATOR
标签,则忽略该参数,并且不会更改对齐方式。
代码示例来源:origin: caoxinyu/RedisClient
label.setAlignment(SWT.CENTER);
label.setImage(code);
代码示例来源:origin: caoxinyu/RedisClient
@Override
public void widgetSelected(SelectionEvent e) {
if (currentText) {
imageType.setEnabled(true);
textType.setEnabled(false);
if (text != null && !text.isDisposed()) {
text.setVisible(false);
text.dispose();
}
label = new Label(grpValue, SWT.NONE);
label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
label.setAlignment(SWT.CENTER);
tranformImage(imageType, label);
currentText = false;
}
}
});
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
/**
* Sets the alignment of the "Example" widgets.
*/
@Override
void setExampleWidgetAlignment () {
int alignment = 0;
if (leftButton.getSelection ()) alignment = SWT.LEFT;
if (centerButton.getSelection ()) alignment = SWT.CENTER;
if (rightButton.getSelection ()) alignment = SWT.RIGHT;
label1.setAlignment (alignment);
label2.setAlignment (alignment);
label3.setAlignment (alignment);
label4.setAlignment (alignment);
label5.setAlignment (alignment);
label6.setAlignment (alignment);
}
代码示例来源:origin: eclipse-jetty/eclipse-jetty-plugin
/**
* Creates a label
*
* @param parent the parent composite
* @param text the text of the label
* @param widthHint the width, <0 to fill up the space
* @param horizontalAlignment the horizontal alignment of the text
* @param horizontalSpan the horizontal span
* @param verticalSpan the vertical span
* @return the label
*/
public static Label createLabel(Composite parent, String text, int widthHint, int horizontalAlignment,
int horizontalSpan, int verticalSpan)
{
Label label = new Label(parent, SWT.NONE);
GridData gridData =
new GridData(SWT.FILL, (verticalSpan <= 1) ? SWT.CENTER : SWT.TOP, widthHint < 0, false, horizontalSpan,
verticalSpan);
if (widthHint >= 0)
{
gridData.widthHint = widthHint;
}
label.setLayoutData(gridData);
label.setText(text);
label.setAlignment(horizontalAlignment);
return label;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
/**
* Controls how text and images will be displayed in the receiver.
* The argument should be one of <code>LEFT</code>, <code>RIGHT</code>
* or <code>CENTER</code>. If the receiver is a <code>SEPARATOR</code>
* label, the argument is ignored and the alignment is not changed.
*
* @param alignment the new alignment
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setAlignment (int alignment) {
checkWidget ();
if ((style & SWT.SEPARATOR) != 0) return;
if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) == 0) return;
style &= ~(SWT.LEFT | SWT.RIGHT | SWT.CENTER);
style |= alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
setAlignment ();
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
/**
* Controls how text and images will be displayed in the receiver.
* The argument should be one of <code>LEFT</code>, <code>RIGHT</code>
* or <code>CENTER</code>. If the receiver is a <code>SEPARATOR</code>
* label, the argument is ignored and the alignment is not changed.
*
* @param alignment the new alignment
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setAlignment (int alignment) {
checkWidget ();
if ((style & SWT.SEPARATOR) != 0) return;
if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) == 0) return;
style &= ~(SWT.LEFT | SWT.RIGHT | SWT.CENTER);
style |= alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
setAlignment ();
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
/**
* Controls how text and images will be displayed in the receiver.
* The argument should be one of <code>LEFT</code>, <code>RIGHT</code>
* or <code>CENTER</code>. If the receiver is a <code>SEPARATOR</code>
* label, the argument is ignored and the alignment is not changed.
*
* @param alignment the new alignment
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setAlignment (int alignment) {
checkWidget ();
if ((style & SWT.SEPARATOR) != 0) return;
if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) == 0) return;
style &= ~(SWT.LEFT | SWT.RIGHT | SWT.CENTER);
style |= alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
setAlignment ();
}
代码示例来源:origin: eclipse-jetty/eclipse-jetty-plugin
/**
* Creates a label with an image
*
* @param parent the parent composite
* @param image the image
* @param widthHint the width, <0 to fill up the space
* @param horizontalAlignment the horizontal alignment
* @param verticalAlignment the vertical alignment
* @param horizontalSpan the horizontal span
* @param verticalSpan the vertical span
* @return the label with an image
*/
public static Label createImage(Composite parent, Image image, int widthHint, int horizontalAlignment,
int verticalAlignment, int horizontalSpan, int verticalSpan)
{
Label label = new Label(parent, SWT.NONE);
GridData gridData =
new GridData(horizontalAlignment, verticalAlignment, false, false, horizontalSpan, verticalSpan);
if (widthHint >= 0)
{
gridData.widthHint = widthHint;
}
label.setAlignment(horizontalAlignment);
label.setLayoutData(gridData);
label.setImage(image);
return label;
}
代码示例来源:origin: cbeust/testng-eclipse
/**
* Add a empty label as a place holder
*/
private void addEmptyLabel(Composite parent){
Label emptyLabel = new Label(parent, 0);
emptyLabel.setAlignment(SWT.LEFT);
GridData statusData = new GridData(GridData.FILL_HORIZONTAL);
emptyLabel.setFont(parent.getFont());
emptyLabel.setLayoutData(statusData);
((GridLayout)parent.getLayout()).numColumns++;
}
代码示例来源:origin: org.eclipse.e4.ui.css/swt
String stringValue = value.getCssText().toLowerCase();
if ("left".equals(stringValue)){
label.setAlignment(SWT.LEFT);
} else if ("lead".equals(stringValue)){
label.setAlignment(SWT.LEAD);
} else if ("right".equals(stringValue)){
label.setAlignment(SWT.RIGHT);
} else if ("trail".equals(stringValue)){
label.setAlignment(SWT.TRAIL);
} else if ("center".equals(stringValue)){
label.setAlignment(SWT.CENTER);
} else if ("inherit".equals(stringValue)) {
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.css.swt
String stringValue = value.getCssText().toLowerCase();
if ("left".equals(stringValue)){
label.setAlignment(SWT.LEFT);
} else if ("lead".equals(stringValue)){
label.setAlignment(SWT.LEAD);
} else if ("right".equals(stringValue)){
label.setAlignment(SWT.RIGHT);
} else if ("trail".equals(stringValue)){
label.setAlignment(SWT.TRAIL);
} else if ("center".equals(stringValue)){
label.setAlignment(SWT.CENTER);
} else if ("inherit".equals(stringValue)) {
代码示例来源:origin: eclipse-jetty/eclipse-jetty-plugin
/**
* Creates an hint.
*
* @param parent the parent composite
* @param text the text of the hint
* @param widthHint the width, <0 to fill up the space
* @param horizontalSpan the horizontal span
* @param verticalSpan the vertical span
* @return the label
*/
public static Label createHint(Composite parent, String text, int widthHint, int horizontalSpan, int verticalSpan)
{
Label label = createLabel(parent, text, widthHint, SWT.LEFT, horizontalSpan, verticalSpan);
label.setAlignment(SWT.RIGHT);
setItalicFont(parent.getDisplay(), label);
return label;
}
代码示例来源:origin: org.metawidget.modules/metawidget-all
label.setAlignment( mLabelAlignment );
代码示例来源:origin: Nodeclipse/EditBox
namesLabel.setAlignment(SWT.RIGHT);
代码示例来源:origin: BiglySoftware/BiglyBT
img_label.setAlignment( SWT.CENTER );
gridData = new GridData( GridData.FILL_BOTH );
img_label.setLayoutData(gridData);
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.intro
/**
* Creates a label to display the link description when you hover over a
* hyperlink.
*
* @param body
*/
private Label createHoverLabel(Composite body) {
Label label = toolkit.createLabel(body, "", SWT.WRAP); //$NON-NLS-1$
String key = StringUtil.concat(rootPage.getId(), ".", "hover-text.fg"); //$NON-NLS-1$ //$NON-NLS-2$
Color fg = rootPageStyleManager.getColor(toolkit, key);
if (fg == null)
fg = toolkit.getColors().getColor(IFormColors.TITLE);
label.setForeground(fg);
label.setAlignment(SWT.CENTER);
label.setFont(PageStyleManager.getBannerFont());
return label;
}
代码示例来源:origin: eclipse-jetty/eclipse-jetty-plugin
versionHint.setAlignment(SWT.LEFT);
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
setFontDescription(defaultFont ().handle);
setAlignment ();
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
setFontDescription(defaultFont ().handle);
setAlignment ();
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
setFontDescription(defaultFont ().handle);
setAlignment ();
内容来源于网络,如有侵权,请联系作者删除!