org.eclipse.swt.widgets.Label.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(12.6k)|赞(0)|评价(0)|浏览(160)

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

Label.<init>介绍

[英]Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

The style value is either one of the style constants defined in class SWT which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using the int "|" operator) two or more of those SWT style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.
[中]给定该类的父类和描述其行为和外观的样式值,构造该类的新实例。
样式值是类SWT中定义的一个样式常量,适用于该类的实例,或者必须通过按位或将两个或多个SWT样式常量(即,使用int“|”运算符)组合在一起来生成。类描述列出了适用于该类的样式常量。样式位也继承自超类。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Create label.
 *
 * @param style
 *          style to use.
 * @param text
 *          text to set.
 * @return new label.
 */
public Label createLabel( final int style, final String text ) {
 final Label label = new Label( this.shell, style );
 label.setText( text );
 return label;
}

代码示例来源:origin: caoxinyu/RedisClient

@Override
protected void initData(Composite dataComposite) {
  Label label = new Label(dataComposite, SWT.NONE);
  label.setText(RedisClient.i18nFile.getText(I18nFile.VALUE));
  label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true, 1, 1));
  
  text_value = new Text(dataComposite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI);
  text_value.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));
}
public Text getText() {

代码示例来源:origin: pentaho/pentaho-kettle

@Override
protected Control addAdditionalComponentIfNeed( int middle, int margin, Composite wFileComp, Composite topComp ) {
 // Run this as a command instead?
 wlFileIsCommand = new Label( wFileComp, SWT.RIGHT );
 wlFileIsCommand
  .setText( BaseMessages.getString( textFileOutputLegacyMetaClass, "TextFileOutputLegacyDialog.FileIsCommand.Label" ) );
 props.setLook( wlFileIsCommand );
 fdlFileIsCommand = new FormData();
 fdlFileIsCommand.left = new FormAttachment( 0, 0 );
 fdlFileIsCommand.top = new FormAttachment( topComp, margin );
 fdlFileIsCommand.right = new FormAttachment( middle, -margin );
 wlFileIsCommand.setLayoutData( fdlFileIsCommand );
 wFileIsCommand = new Button( wFileComp, SWT.CHECK );
 props.setLook( wFileIsCommand );
 fdFileIsCommand = new FormData();
 fdFileIsCommand.left = new FormAttachment( middle, 0 );
 fdFileIsCommand.top = new FormAttachment( topComp, margin );
 fdFileIsCommand.right = new FormAttachment( 100, 0 );
 wFileIsCommand.setLayoutData( fdFileIsCommand );
 wFileIsCommand.addSelectionListener( new SelectionAdapter() {
  public void widgetSelected( SelectionEvent e ) {
   input.setChanged();
   enableParentFolder();
  }
 } );
 return wlFileIsCommand;
}

代码示例来源:origin: pentaho/pentaho-kettle

public Composite getComposite( Composite parent, ImportRuleInterface importRule ) {
 rule = (DatabaseConfigurationImportRule) importRule;
 databaseMeta = rule.getDatabaseMeta();
 PropsUI props = PropsUI.getInstance();
 composite = new Composite( parent, SWT.NONE );
 props.setLook( composite );
 composite.setLayout( new FillLayout() );
 label = new Label( composite, SWT.SINGLE | SWT.BORDER | SWT.LEFT );
 props.setLook( label );
 label.setText( "Database configuration : (not configured)" );
 button = new Button( composite, SWT.PUSH );
 button.setText( "Edit..." );
 button.addSelectionListener( new SelectionAdapter() {
  public void widgetSelected( SelectionEvent event ) {
   editDatabase();
  }
 } );
 return composite;
}

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  final Shell dialog = new Shell( shell, SWT.DIALOG_TRIM );
  dialog.setText( BaseMessages.getString( PKG, "JobGetPOP.SelectDate" ) );
  dialog.setImage( GUIResource.getInstance().getImageSpoon() );
  dialog.setLayout( new GridLayout( 3, false ) );
  final DateTime calendar = new DateTime( dialog, SWT.CALENDAR );
  final DateTime time = new DateTime( dialog, SWT.TIME | SWT.TIME );
  new Label( dialog, SWT.NONE );
  new Label( dialog, SWT.NONE );
  Button ok = new Button( dialog, SWT.PUSH );
  ok.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
  ok.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) );
  ok.addSelectionListener( new SelectionAdapter() {
   public void widgetSelected( SelectionEvent e ) {
    Calendar cal = Calendar.getInstance();
    cal.set( Calendar.YEAR, calendar.getYear() );
    cal.set( Calendar.MONTH, calendar.getMonth() );
    cal.set( Calendar.DAY_OF_MONTH, calendar.getDay() );
    cal.set( Calendar.HOUR_OF_DAY, time.getHours() );
    cal.set( Calendar.MINUTE, time.getMinutes() );
    cal.set( Calendar.SECOND, time.getSeconds() );
    wReadFrom.setText( new SimpleDateFormat( JobEntryGetPOP.DATE_PATTERN ).format( cal.getTime() ) );
    dialog.close();
   }
  } );
  dialog.setDefaultButton( ok );
  dialog.pack();
  dialog.open();
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

private void layoutComposite() {
 FormLayout flAuthComp = new FormLayout();
 this.setLayout( flAuthComp );
 wAuthGroup.setText( authGroupLabel );
 FormLayout flAuthGroup = new FormLayout();
 flAuthGroup.marginHeight = 15;
 flAuthGroup.marginWidth = 15;
 wlUsername = new Label( wAuthGroup, SWT.LEFT );
 props.setLook( wlUsername );
 wlUsername.setText( usernameLabel );
 wlUsername.setLayoutData( new FormDataBuilder().left().top().result() );
 wlPassword = new Label( wAuthGroup, SWT.LEFT );
 props.setLook( wlPassword );
 wlPassword.setText( passwordLabel );
 wlPassword.setLayoutData( new FormDataBuilder().left().top( wUsername, ConstUI.MEDUIM_MARGIN ).result() );

代码示例来源:origin: pentaho/pentaho-kettle

public LabelText( Composite composite, int textStyle, String labelText, String toolTipText, int middle,
 int margin ) {
 super( composite, SWT.NONE );
 props.setLook( this );
 FormLayout formLayout = new FormLayout();
 formLayout.marginWidth = 0;
 formLayout.marginHeight = 0;
 this.setLayout( formLayout );
 wText = new Text( this, textStyle );
 FormData fdText = new FormData();
 fdText.left = new FormAttachment( middle, margin );
 fdText.right = new FormAttachment( 100, 0 );
 wText.setLayoutData( fdText );
 wText.setToolTipText( toolTipText );
 wLabel = new Label( this, SWT.RIGHT );
 props.setLook( wLabel );
 wLabel.setText( labelText );
 FormData fdLabel = new FormData();
 fdLabel.left = new FormAttachment( 0, 0 );
 fdLabel.right = new FormAttachment( middle, 0 );
 fdLabel.top = new FormAttachment( wText, 0, SWT.CENTER );
 wLabel.setLayoutData( fdLabel );
 wLabel.setToolTipText( toolTipText );
}

代码示例来源:origin: caoxinyu/RedisClient

composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
Label lblNewLabel = new Label(composite, SWT.WRAP);
lblNewLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
lblNewLabel.setText(RedisClient.i18nFile.getText(I18nFile.DONATIONMESSAGE));
Label label = new Label(composite, SWT.NONE);
label.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
label.setAlignment(SWT.CENTER);
label.setImage(code);
composite_1.setLayout(new FillLayout(SWT.HORIZONTAL));
Button btnOk = new Button(composite_1, SWT.NONE);
btnOk.addSelectionListener(new SelectionAdapter() {
  @Override
btnOk.setText(RedisClient.i18nFile.getText(I18nFile.OK));

代码示例来源:origin: pentaho/pentaho-kettle

new Label( dialog, SWT.NONE );
new Label( dialog, SWT.NONE );
Button ok = new Button( dialog, SWT.PUSH );
ok.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
ok.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) );
ok.addSelectionListener( new SelectionAdapter() {

代码示例来源:origin: pentaho/pentaho-kettle

private Label addStandardLabel( String messageString, Control previousControl ) {
 Label label = new Label( shell, SWT.RIGHT );
 label.setText( messageString );
 label.setLayoutData( standardLabelSpacing( previousControl, label ) );
 props.setLook( label );
 return label;
}

代码示例来源:origin: caoxinyu/RedisClient

protected void initObjectTabItem() {
  RedisObject object = service.getObjectInfo(id, db, key);
  
  objectTabItem = new TabItem(tabFolder, SWT.NONE);
  objectTabItem.setText(RedisClient.i18nFile.getText(I18nFile.OBJECT));
  
  Composite objectComposite = new Composite(tabFolder, SWT.NONE);
  objectTabItem.setControl(objectComposite);
  objectComposite.setLayout(new GridLayout(4, true));
  
  label1 = new Label(objectComposite, SWT.NONE);
  label1.setText(RedisClient.i18nFile.getText(I18nFile.REFCOUNT));
  Label label_1 = new Label(objectComposite, SWT.NONE);
  label_1.setText(object.getRefCount().toString());
  
  label2 = new Label(objectComposite, SWT.NONE);
  label2.setText(RedisClient.i18nFile.getText(I18nFile.ENCODING));
  Label label_2 = new Label(objectComposite, SWT.NONE);
  label_2.setText(object.getEncoding());
}

代码示例来源:origin: pentaho/pentaho-kettle

private void setWarningIcon( Display display ) {
 warningIcon = new Label( shell, SWT.NONE );
 Image image = display.getSystemImage( SWT.ICON_WARNING );
 warningIcon.setImage( image );
 props.setLook( warningIcon );
 FormData fdIcon = new FormData();
 fdIcon.left = new FormAttachment( 0, 0 );
 fdIcon.top = new FormAttachment( 0, 0 );
 fdIcon.right = new FormAttachment( 0, image.getBounds().width );
 fdIcon.bottom = new FormAttachment( 0, image.getBounds().height ); //icon should be at the top left corner
 warningIcon.setLayoutData( fdIcon );
}

代码示例来源:origin: caoxinyu/RedisClient

composite.setLayout(new GridLayout(2, false));
btnExpire = new Button(composite, SWT.CHECK);
btnExpire.setText(RedisClient.i18nFile.getText(I18nFile.EXPIRE));
labelTTL = new Label(composite, SWT.NONE);
labelTTL.setEnabled(false);
labelTTL.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
labelTTL.setText(RedisClient.i18nFile.getText(I18nFile.TTLS));

代码示例来源:origin: pentaho/pentaho-kettle

new Label( dialogto, SWT.NONE );
new Label( dialogto, SWT.NONE );
Button okto = new Button( dialogto, SWT.PUSH );
okto.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
okto.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) );
okto.addSelectionListener( new SelectionAdapter() {

代码示例来源:origin: pentaho/pentaho-kettle

private Label addStandardLabel( String messageString, Control previousControl ) {
 Label label = new Label( shell, SWT.RIGHT );
 label.setText( messageString );
 label.setLayoutData( standardLabelSpacing( previousControl ) );
 props.setLook( label );
 return label;
}

代码示例来源:origin: pentaho/pentaho-kettle

public Composite getComposite( Composite parent, ImportRuleInterface importRule ) {
 PropsUI props = PropsUI.getInstance();
 composite = new Composite( parent, SWT.NONE );
 props.setLook( composite );
 composite.setLayout( new FillLayout() );
 Label label = new Label( composite, SWT.SINGLE | SWT.BORDER | SWT.LEFT );
 props.setLook( label );
 label.setText( "Minimum length: " );
 text = new Text( composite, SWT.SINGLE | SWT.BORDER | SWT.LEFT );
 props.setLook( text );
 return composite;
}

代码示例来源:origin: pentaho/pentaho-kettle

private void placeControl( Shell pShell, String text, Control control, Control under ) {
 int middle = props.getMiddlePct();
 int margin = Const.MARGIN;
 Label label = new Label( pShell, SWT.RIGHT );
 label.setText( text );
 props.setLook( label );
 FormData formDataLabel = new FormData();
 formDataLabel.left = new FormAttachment( 0, 0 );
 if ( under != null ) {
  formDataLabel.top = new FormAttachment( under, margin );
 } else {
  formDataLabel.top = new FormAttachment( 0, 0 );
 }
 formDataLabel.right = new FormAttachment( middle, 0 );
 label.setLayoutData( formDataLabel );
 props.setLook( control );
 FormData formDataControl = new FormData();
 formDataControl.left = new FormAttachment( middle, 0 );
 if ( under != null ) {
  formDataControl.top = new FormAttachment( under, margin );
 } else {
  formDataControl.top = new FormAttachment( 0, 0 );
 }
 formDataControl.right = new FormAttachment( 100, 0 );
 control.setLayoutData( formDataControl );
}

代码示例来源:origin: caoxinyu/RedisClient

ttlComposite.setLayout(new GridLayout(2, false));
btnExpire = new Button(ttlComposite, SWT.CHECK);
btnExpire.setText(RedisClient.i18nFile.getText(I18nFile.EXPIRE));
labelTTL = new Label(ttlComposite, SWT.NONE);
labelTTL.setEnabled(false);
labelTTL.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
labelTTL.setText(RedisClient.i18nFile.getText(I18nFile.TTLS));

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  final Shell dialog = new Shell( shell, SWT.DIALOG_TRIM );
  dialog.setText( BaseMessages.getString( PKG, "MailInput.SelectDate" ) );
  dialog.setImage( GUIResource.getInstance().getImageSpoon() );
  dialog.setLayout( new GridLayout( 3, false ) );
  final DateTime calendar = new DateTime( dialog, SWT.CALENDAR );
  final DateTime time = new DateTime( dialog, SWT.TIME | SWT.TIME );
  new Label( dialog, SWT.NONE );
  new Label( dialog, SWT.NONE );
  Button ok = new Button( dialog, SWT.PUSH );
  ok.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
  ok.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) );
  ok.addSelectionListener( new SelectionAdapter() {
   public void widgetSelected( SelectionEvent e ) {
    Calendar cal = Calendar.getInstance();
    cal.set( Calendar.YEAR, calendar.getYear() );
    cal.set( Calendar.MONTH, calendar.getMonth() );
    cal.set( Calendar.DAY_OF_MONTH, calendar.getDay() );
    cal.set( Calendar.HOUR_OF_DAY, time.getHours() );
    cal.set( Calendar.MINUTE, time.getMinutes() );
    cal.set( Calendar.SECOND, time.getSeconds() );
    wReadFrom.setText( new SimpleDateFormat( MailInputMeta.DATE_PATTERN ).format( cal.getTime() ) );
    dialog.close();
   }
  } );
  dialog.setDefaultButton( ok );
  dialog.pack();
  dialog.open();
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

@Override
 protected Control buildBody() {
  final Label message = new Label( shell, SWT.WRAP | SWT.LEFT );
  message.setText( this.message );
  props.setLook( message );
  message.setLayoutData( new FormDataBuilder().top().left().right( 100, 0 ).result() );
  return message;
 }
}

相关文章