org.eclipse.swt.widgets.Button.setAlignment()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中org.eclipse.swt.widgets.Button.setAlignment()方法的一些代码示例,展示了Button.setAlignment()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.setAlignment()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Button
类名称:Button
方法名:setAlignment

Button.setAlignment介绍

[英]Controls how text, images and arrows will be displayed in the receiver. The argument should be one of LEFT, RIGHT or CENTER unless the receiver is an ARROW button, in which case, the argument indicates the direction of the arrow (one of LEFT, RIGHT, UP or DOWN).
[中]控制文本、图像和箭头在接收器中的显示方式。参数应该是LEFTRIGHTCENTER中的一个,除非接收者是ARROW按钮,在这种情况下,参数指示箭头的方向(LEFTRIGHTUPDOWN中的一个)。

代码示例

代码示例来源: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;
  if (upButton.getSelection ()) alignment = SWT.UP;
  if (downButton.getSelection ()) alignment = SWT.DOWN;
  button1.setAlignment (alignment);
  button2.setAlignment (alignment);
  button3.setAlignment (alignment);
  button4.setAlignment (alignment);
  button5.setAlignment (alignment);
  button6.setAlignment (alignment);
  button7.setAlignment (alignment);
  button8.setAlignment (alignment);
  button9.setAlignment (alignment);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

/**
 * Create the isEditable button and it's associated label as a child of
 * parent using the editableValue of the receiver. The Composite will be the
 * parent of the button.
 *
 * @param composite
 *            the parent of the button
 */
private void createEditableButton(Composite composite) {
  this.editableBox = new Button(composite, SWT.CHECK | SWT.RIGHT);
  this.editableBox.setAlignment(SWT.LEFT);
  this.editableBox.setText(READ_ONLY);
  this.editableBox.setSelection(this.previousReadOnlyValue);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

/**
 * Create the isLocked button and it's associated label as a child of
 * parent using the editableValue of the receiver. The Composite will be the
 * parent of the button.
 *
 * @param composite
 *            the parent of the button
 */
private void createImmutableButton(Composite composite) {
  this.immutableBox = new Button(composite, SWT.CHECK | SWT.RIGHT);
  this.immutableBox.setAlignment(SWT.LEFT);
  this.immutableBox.setText(LOCKED);
  this.immutableBox.setSelection((this.previousPermissionsValue & EFS.ATTRIBUTE_IMMUTABLE) != 0);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

/**
 * Create the isExecutable button and it's associated label as a child of
 * parent using the editableValue of the receiver. The Composite will be the
 * parent of the button.
 *
 * @param composite
 *            the parent of the button
 */
private void createExecutableButton(Composite composite) {
  this.executableBox = new Button(composite, SWT.CHECK | SWT.RIGHT);
  this.executableBox.setAlignment(SWT.LEFT);
  this.executableBox.setText(EXECUTABLE);
  this.executableBox.setSelection(this.previousExecutableValue);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

/**
 * Create the isArchive button and it's associated label as a child of
 * parent using the editableValue of the receiver. The Composite will be the
 * parent of the button.
 *
 * @param composite
 *            the parent of the button
 */
private void createArchiveButton(Composite composite) {
  this.archiveBox = new Button(composite, SWT.CHECK | SWT.RIGHT);
  this.archiveBox.setAlignment(SWT.LEFT);
  this.archiveBox.setText(ARCHIVE);
  this.archiveBox.setSelection(this.previousArchiveValue);
}

代码示例来源:origin: org.eclipse/org.eclipse.datatools.sqltools.common.ui

/**
 * Creates a new checkbox and sets the default layout data.
 * 
 * @param parent
 *            the composite in which to create the checkbox
 * @param label
 *            the string to set into the checkbox
 * @param numColumns
 *            the number of columns the new checkbox is to occupy
 * @param indent
 *            the number of pixels to indent from the left
 * @return the new checkbox
 */
public static Button createCheckBox(Composite parent, String label,
  int numColumns, int indent) 
{
  Button button = new Button(parent, SWT.CHECK | SWT.LEFT);
  if (label == null)
  button.setAlignment(SWT.CENTER);
  GridData data = new GridData(GridData.FILL);
  data.horizontalSpan = numColumns;
  data.horizontalIndent = indent;
  button.setLayoutData(data);
  if (label != null)
  button.setText(label);
  return button;
}
/**

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

/**
 * Create the derived button and it's associated label as a child of parent
 * using the derived of the receiver. The Composite will be the parent of
 * the button.
 *
 * @param composite
 *            the parent of the button
 * @param resource
 *            the resource the information is being taken from
 */
private void createDerivedButton(Composite composite, IResource resource) {
  this.derivedBox = new Button(composite, SWT.CHECK | SWT.RIGHT);
  this.derivedBox.setAlignment(SWT.LEFT);
  if (resource.getParent().isDerived(IResource.CHECK_ANCESTORS))
    this.derivedBox.setText(DERIVED_HAS_DERIVED_ANCESTOR);
  else
    this.derivedBox.setText(DERIVED);
  this.derivedBox.setSelection(this.previousDerivedValue);
}

代码示例来源:origin: org.eclipse/org.eclipse.datatools.sqltools.common.ui

/**
 * Utility method that creates a push button instance and sets the default
 * layout data.
 * 
 * @param parent
 *            the parent for the new button
 * @param label
 *            the label for the new button
 * @param widthHint
 *            use this width for the button.
 * @return the newly-created button
 */
public static Button createPushButton(Composite parent, Image theImage,
  int widthHint) 
{
  Button button = new Button(parent, SWT.PUSH);
  GridData data = new GridData();
  data.horizontalAlignment = GridData.FILL_HORIZONTAL;
  data.widthHint = widthHint;
  button.setLayoutData(data);
  button.setImage(theImage);
  button.setAlignment(SWT.CENTER);
  return button;
}
/**

代码示例来源:origin: org.eclipse.e4.ui.css/swt

String stringValue = value.getCssText().toLowerCase();
if ("left".equals(stringValue)){
  button.setAlignment(SWT.LEFT);
} else if ("lead".equals(stringValue)){
  button.setAlignment(SWT.LEAD);
} else if ("right".equals(stringValue)){
  button.setAlignment(SWT.RIGHT);
} else if ("trail".equals(stringValue)){
  button.setAlignment(SWT.TRAIL);
} else if ("center".equals(stringValue)){
  button.setAlignment(SWT.CENTER);
} else if ("up".equals(stringValue)){
  button.setAlignment(SWT.UP);
} else if ("down".equals(stringValue)){
  button.setAlignment(SWT.DOWN);
} else if ("inherit".equals(stringValue)) {

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.css.swt

String stringValue = value.getCssText().toLowerCase();
if ("left".equals(stringValue)){
  button.setAlignment(SWT.LEFT);
} else if ("lead".equals(stringValue)){
  button.setAlignment(SWT.LEAD);
} else if ("right".equals(stringValue)){
  button.setAlignment(SWT.RIGHT);
} else if ("trail".equals(stringValue)){
  button.setAlignment(SWT.TRAIL);
} else if ("center".equals(stringValue)){
  button.setAlignment(SWT.CENTER);
} else if ("up".equals(stringValue)){
  button.setAlignment(SWT.UP);
} else if ("down".equals(stringValue)){
  button.setAlignment(SWT.DOWN);
} else if ("inherit".equals(stringValue)) {

代码示例来源:origin: Nodeclipse/EditBox

pluginEnabled.setLayoutData(gd);
pluginEnabled.setText("Plugin enabled");
pluginEnabled.setAlignment(SWT.RIGHT);
pluginEnabled.addSelectionListener(new SelectionAdapter() {
  public void widgetSelected(SelectionEvent e) {

代码示例来源:origin: Nodeclipse/EditBox

enabled.setLayoutData(gd);
enabled.setText("Enabled");
enabled.setAlignment(SWT.RIGHT);
enabled.addSelectionListener(new SelectionAdapter() {
  public void widgetSelected(SelectionEvent e) {

代码示例来源:origin: BiglySoftware/BiglyBT

button.setAlignment( SWT.LEFT );
Utils.setTT(button, long_name );

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

fCustomButton.setAlignment(SWT.LEFT);

相关文章

Button类方法