org.eclipse.swt.widgets.Label类的使用及代码示例

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

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

Label介绍

[英]Empty stub Java type that is used ONLY by the DSL when running in standalone mode, i.e., through the xtext-maven-plugin.
[中]空存根Java类型,在独立模式下运行时,即通过xtext maven插件,仅由DSL使用。

代码示例

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

Label imageLabel = new Label( composite, SWT.NONE );
imageLabel.setImage( image );
imageLabel.setBackground( display.getSystemColor( SWT.COLOR_INFO_BACKGROUND ) );
FormData fdImageLabel = new FormData();
fdImageLabel.left = new FormAttachment( 0, 0 );
fdImageLabel.top = new FormAttachment( 0, 0 );
imageLabel.setLayoutData( fdImageLabel );
Label titleLabel = new Label( composite, SWT.LEFT );
titleLabel.setText( title );
titleLabel.setBackground( display.getSystemColor( SWT.COLOR_INFO_BACKGROUND ) );
titleLabel.setFont( GUIResource.getInstance().getFontBold() );
FormData fdTitleLabel = new FormData();
fdTitleLabel.left = new FormAttachment( imageLabel, 20 );
fdTitleLabel.top = new FormAttachment( 0, 0 );
titleLabel.setLayoutData( fdTitleLabel );
Label line = new Label( composite, SWT.SEPARATOR | SWT.HORIZONTAL );
line.setBackground( display.getSystemColor( SWT.COLOR_INFO_BACKGROUND ) );
line.setLayoutData( fdLine );
Label messageLabel = new Label( composite, SWT.LEFT );
messageLabel.setText( message );
messageLabel.setBackground( display.getSystemColor( SWT.COLOR_INFO_BACKGROUND ) );
messageLabel.setLayoutData( fdMessageLabel );

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

private void setTabFlags( Button wMainPath, Label wlInputStep, Text wInputStep, Button wbInputStep,
             Label wlOutputStep, Text wOutputStep, Button wbOutputStep, Label wlDescription,
             Text wDescription ) {
 boolean mainPath = wMainPath.getSelection();
 wlInputStep.setEnabled( !mainPath );
 wInputStep.setEnabled( !mainPath );
 wbInputStep.setEnabled( !mainPath );
 wlOutputStep.setEnabled( !mainPath );
 wOutputStep.setEnabled( !mainPath );
 wbOutputStep.setEnabled( !mainPath );
 wlDescription.setEnabled( !mainPath );
 wDescription.setEnabled( !mainPath );
}

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

/**
 * build icon cell
 */
protected void buildIconCell() {
 Image icon = Display.getCurrent().getSystemImage( SWT.ICON_INFORMATION );
 this.iconLabel = new Label( this.dialog, SWT.NONE );
 this.iconLabel.setImage( icon );
 GridData grdData = new GridData();
 grdData.horizontalIndent = DEFAULT_INDENT;
 grdData.verticalIndent = DEFAULT_INDENT;
 this.iconLabel.setLayoutData( grdData );
}

代码示例来源: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: pentaho/pentaho-kettle

public void handleEvent( Event event ) {
  cancelButton.setImage(
    new Image( display, GoogleAuthorizationDialog.class.getResourceAsStream( "/images/close-button-hover.png" ) ) );
  cancelButton.setCursor( new Cursor( display, SWT.CURSOR_HAND ) );
 }
} );

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

Display display = parent.getDisplay();
final Font largeFont = GUIResource.getInstance().getFontBold();
final Color gray = GUIResource.getInstance().getColorDemoGray();
 new Shell( parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN | SWT.APPLICATION_MODAL | SWT.SHEET );
wlDesc = new Label( shell, SWT.NONE );
wlDesc.setText( message );
props.setLook( wlDesc );
fdlDesc = new FormData();
fdlDesc.left = new FormAttachment( 0, 0 );
fdlDesc.top = new FormAttachment( 0, margin );
wlDesc.setLayoutData( fdlDesc );
wlDesc.setFont( largeFont );
wDesc = new Text( shell, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL );
 wDesc.setText( exMsgFunction.apply( text.toString() ) );
} else {
 text.append( message );
 wDesc.setText( exMsgFunction.apply( text.toString() ) );
fdDesc.left = new FormAttachment( 0, 0 );
 if ( !display.readAndDispatch() ) {
  display.sleep();

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

public int open() {
 Shell parent = getParent();
 Display display = parent.getDisplay();
 shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX );
 props.setLook( shell );
 formLayout.marginHeight = 15;
 shell.setLayout( formLayout );
 Image image = display.getSystemImage( SWT.ICON_WARNING );
 Label wIcon = new Label( shell, SWT.NONE );
 props.setLook( wIcon );
 wIcon.setImage( image );
 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 );
 wIcon.setLayoutData( fdIcon );
 wcMessage.setLayoutData( fdcMessage );
  if ( !display.readAndDispatch() ) {
   display.sleep();

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

shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.SHEET | SWT.RESIZE );
shell.setImage( GUIResource.getInstance().getImageSpoon() );
props.setLook( shell );
Label wlImage = new Label( shell, SWT.NONE );
wlImage.setImage( GUIResource.getInstance().getImageWarning32() );
FormData fdWarnImage = new FormData();
fdWarnImage.left = new FormAttachment( 0, 15 );
fdWarnImage.top = new FormAttachment( 0, 15 );
fdWarnImage.height = 32;
fdWarnImage.width = 32;
wlImage.setLayoutData( fdWarnImage );
props.setLook( wlImage );
Label wlMessage = new Label( shell, SWT.FLAT  | SWT.WRAP );
wlMessage.setText( message );
FormData fdMessage = new FormData();
fdMessage.left = new FormAttachment( wlImage, 15, SWT.RIGHT );
wlMessage.setLayoutData( fdMessage );
props.setLook( wlMessage );
Button spacer = new Button( shell, SWT.NONE );
 if ( !display.readAndDispatch() ) {
  display.sleep();

代码示例来源: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

Composite composite = new Composite( parent, SWT.NONE );
props.setLook( composite );
compLayout.marginHeight = Const.FORM_MARGIN;
compLayout.marginWidth = Const.FORM_MARGIN;
composite.setLayout( compLayout );
wlServername = new Label( composite, SWT.RIGHT );
wlServername.setText( BaseMessages.getString( PKG, "CreateDatabaseWizardPageInformix.Servername.Label" ) );
props.setLook( wlServername );
fdlServername = new FormData();
fdlServername.top = new FormAttachment( 0, 0 );
fdlServername.left = new FormAttachment( 0, 0 );
fdlServername.right = new FormAttachment( middle, 0 );
wlServername.setLayoutData( fdlServername );
wServername = new Text( composite, SWT.SINGLE | SWT.BORDER );
props.setLook( wServername );
fdServername = new FormData();
fdServername.left = new FormAttachment( middle, margin );
fdServername.right = new FormAttachment( 100, 0 );
wServername.setLayoutData( fdServername );
wServername.addModifyListener( new ModifyListener() {
 public void modifyText( ModifyEvent arg0 ) {
  setPageComplete( false );

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

shell.setText(RedisClient.i18nFile.getText(I18nFile.DONATION));
shell.setLayout(new GridLayout(1, false));
Composite composite = new Composite(shell, SWT.NONE);
composite.setLayout(new GridLayout(1, false));
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 composite_1 = new Composite(shell, SWT.NONE);
composite_1.setLayout(new FillLayout(SWT.HORIZONTAL));
Button btnOk = new Button(composite_1, SWT.NONE);
btnOk.addSelectionListener(new SelectionAdapter() {
  @Override
  public void widgetSelected(SelectionEvent arg0) {
btnOk.setText(RedisClient.i18nFile.getText(I18nFile.OK));

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

if ( perfComposite.isDisposed() ) {
 return;
Label label = new Label( perfComposite, SWT.CENTER );
label.setText( BaseMessages.getString( PKG, "TransLog.Dialog.PerformanceMonitoringNotEnabled.Message" ) );
label.setBackground( perfComposite.getBackground() );
label.setFont( GUIResource.getInstance().getFontMedium() );
fdLabel.left = new FormAttachment( 5, 0 );
fdLabel.right = new FormAttachment( 95, 0 );
fdLabel.top = new FormAttachment( 5, 0 );
label.setLayoutData( fdLabel );
Button button = new Button( perfComposite, SWT.CENTER );
button.setText( BaseMessages.getString( PKG, "TransLog.Dialog.PerformanceMonitoring.Button" ) );
button.setBackground( perfComposite.getBackground() );
button.setFont( GUIResource.getInstance().getFontMedium() );

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

private void initNamespace(TabFolder tabFolder) {
  TabItem tbtmNamespace = new TabItem(tabFolder, SWT.NONE);
  tbtmNamespace.setText(RedisClient.i18nFile.getText(I18nFile.NAMESPACE));
  
  Composite composite = new Composite(tabFolder, SWT.NONE);
  tbtmNamespace.setControl(composite);
  composite.setLayout(new GridLayout(2, false));
  
  Label lblSeparator = new Label(composite, SWT.NONE);
  lblSeparator.setText(RedisClient.i18nFile.getText(I18nFile.SEPARATOR));
  
  separator = new Text(composite, SWT.BORDER);
  separator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
  separator.setText(ConfigFile.getSeparator());
  separator.addModifyListener(new ModifyListener() {
    public void modifyText(ModifyEvent e) {
      separator.setData(true);
    }
  });
  separator.setData(false);
}

代码示例来源: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

closeButton = new Label( extraViewComposite, SWT.NONE );
closeButton.setImage( GUIResource.getInstance().getImageClosePanel() );
closeButton
 .setToolTipText( BaseMessages.getString( PKG, "JobGraph.ExecutionResultsPanel.CloseButton.Tooltip" ) );
FormData fdClose = new FormData();
fdClose.right = new FormAttachment( 100, 0 );
fdClose.top = new FormAttachment( 0, 0 );
closeButton.setLayoutData( fdClose );
closeButton.addMouseListener( new MouseAdapter() {
 public void mouseDown( MouseEvent e ) {
  disposeExtraView();
minMaxButton = new Label( extraViewComposite, SWT.NONE );
minMaxButton.setImage( GUIResource.getInstance().getImageMaximizePanel() );
minMaxButton
 .setToolTipText( BaseMessages.getString( PKG, "JobGraph.ExecutionResultsPanel.MaxButton.Tooltip" ) );
FormData fdMinMax = new FormData();
fdMinMax.right = new FormAttachment( closeButton, -Const.MARGIN );
fdMinMax.top = new FormAttachment( 0, 0 );
minMaxButton.setLayoutData( fdMinMax );
minMaxButton.addMouseListener( new MouseAdapter() {
 public void mouseDown( MouseEvent e ) {
  minMaxExtraView();
Label wResultsLabel = new Label( extraViewComposite, SWT.LEFT );
wResultsLabel.setFont( GUIResource.getInstance().getFontMediumBold() );
wResultsLabel.setBackground( GUIResource.getInstance().getColorWhite() );
wResultsLabel.setText( BaseMessages.getString( PKG, "JobLog.ResultsPanel.NameLabel" ) );

代码示例来源: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

@Override
protected Control createMessageArea( Composite composite ) {
 GridLayout gridLayout = (GridLayout) composite.getLayout();
 gridLayout.numColumns = 1;
 composite.setLayout( gridLayout );
 if ( this.message != null ) {
  this.messageLabel = new Label( composite, this.getMessageLabelStyle() );
  this.messageLabel.setText( this.message );
 }
 if ( this.details != null ) {
  this.detailsText = new Text( composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL );
  this.detailsText.pack();
  this.detailsText.setText( this.details );
  GridData gridData = new GridData( );
  gridData.widthHint = 1024;
  gridData.heightHint = 300;
  this.detailsText.setLayoutData( gridData );
  this.detailsText.setSelection( this.details.length() );
 }
 return composite;
}

代码示例来源: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

protected void runConfigurationSectionLayout( Class<?> PKG, String prefix ) {
 cRunConfiguration = new Composite( shell, SWT.NONE );
 cRunConfiguration.setLayout( new FormLayout() );
 props.setLook( cRunConfiguration );
 FormData fdLocal = new FormData();
 fdLocal.top = new FormAttachment( 0, 15 );
 fdLocal.right = new FormAttachment( 100, -15 );
 fdLocal.left = new FormAttachment( 0, 15 );
 cRunConfiguration.setBackground( shell.getBackground() ); // the default looks ugly
 cRunConfiguration.setLayoutData( fdLocal );
 Label wlRunConfiguration = new Label( cRunConfiguration, SWT.LEFT );
 props.setLook( wlRunConfiguration );
 wlRunConfiguration.setText( "Run configuration:" );
 FormData fdlRunConfiguration = new FormData();
 fdlRunConfiguration.top = new FormAttachment( 0 );
 fdlRunConfiguration.left = new FormAttachment( 0 );
 wlRunConfiguration.setLayoutData( fdlRunConfiguration );
 wRunConfiguration = new CCombo( cRunConfiguration, SWT.BORDER );
 props.setLook( wRunConfiguration );
 FormData fdRunConfiguration = new FormData();
 fdRunConfiguration.width = 200;
 fdRunConfiguration.top = new FormAttachment( wlRunConfiguration, 5 );
 fdRunConfiguration.left = new FormAttachment( 0 );
 wRunConfiguration.setLayoutData( fdRunConfiguration );
}

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

private void buildHeader() {
 buildPreHeader();
 // Step icon
 final Label wicon = new Label( shell, SWT.RIGHT );
 wicon.setImage( getImage() );
 wicon.setLayoutData( new FormDataBuilder().top( 0, -BaseDialog.LABEL_SPACING ).right( 100, 0 ).result() );
 props.setLook( wicon );
 // Step name label
 wlStepname = new Label( shell, SWT.RIGHT );
 wlStepname.setText( BaseMessages.getString( PKG, "CommonStepDialog.Stepname.Label" ) ); //$NON-NLS-1$
 props.setLook( wlStepname );
 fdlStepname = new FormDataBuilder().left( 0, 0 ).top( 0, -BaseDialog.LABEL_SPACING ).result();
 wlStepname.setLayoutData( fdlStepname );
 // Step name field
 wStepname = new Text( shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
 wStepname.setText( stepname );
 props.setLook( wStepname );
 wStepname.addModifyListener( lsMod );
 wStepname.addSelectionListener( lsDef );
 fdStepname = new FormDataBuilder().width( BaseDialog.MEDIUM_FIELD ).left( 0, 0 ).top(
  wlStepname, BaseDialog.LABEL_SPACING ).result();
 wStepname.setLayoutData( fdStepname );
 // horizontal separator between step name and tabs
 headerSpacer = new Label( shell, SWT.HORIZONTAL | SWT.SEPARATOR );
 props.setLook( headerSpacer );
 headerSpacer.setLayoutData( new FormDataBuilder().left().right( 100, 0 ).top(
  wStepname, BaseDialog.MARGIN_SIZE ).width( SHELL_WIDTH - 2 * ( BaseDialog.MARGIN_SIZE ) ).result() );
 buildPostHeader();
}

相关文章