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

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

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

Label.getDisplay介绍

暂无

代码示例

代码示例来源:origin: com.github.rinde/rinsim-example

final void update() {
  label.getDisplay().asyncExec(new Runnable() {
   @Override
   public void run() {
    label.setText(monitor.getBounds().width + " x "
     + monitor.getBounds().height + "\n" + runner.getState());
   }
  });
 }
}

代码示例来源:origin: rinde/RinSim

final void update() {
  label.getDisplay().asyncExec(new Runnable() {
   @Override
   public void run() {
    label.setText(monitor.getBounds().width + " x "
     + monitor.getBounds().height + "\n" + runner.getState());
   }
  });
 }
}

代码示例来源:origin: org.xworker/xworker_swt

public void setLabel(final String text){
  if(text == null || label == null || label.isDisposed()){
    return;
  }
  
  label.getDisplay().asyncExec(new Runnable(){
    public void run(){
      label.setText(text);
    }
  });        
}

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

/**
 * Get the system default font data.
 * @return FontData[]
 */
private FontData[] getDefaultFontData() {
  return valueControl.getDisplay().getSystemFont().getFontData();
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface

/**
 * Get the system default font data.
 * @return FontData[]
 */
private FontData[] getDefaultFontData() {
  return valueControl.getDisplay().getSystemFont().getFontData();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface

/**
 * Get the system default font data.
 * @return FontData[]
 */
private FontData[] getDefaultFontData() {
  return valueControl.getDisplay().getSystemFont().getFontData();
}

代码示例来源:origin: org.eclipse/org.eclipse.datatools.connectivity.sqm.core.ui

public void handleEvent(Event event) {
    if (statusMessage != null && validator != null) {
      String errorMsg = validator.isValid(group
          .getSelection());
      if (errorMsg == null || errorMsg.equals("")) { //$NON-NLS-1$
        statusMessage.setText(""); //$NON-NLS-1$
        getOkButton().setEnabled(true);
      } else {
        statusMessage.setForeground(JFaceColors
            .getErrorText(statusMessage.getDisplay()));
        statusMessage.setText(errorMsg);
        getOkButton().setEnabled(false);
      }
    }
  }
};

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

private void setArgumentLabelEnabled() {
  if (argumentsLabel != null) {
    Color color = argumentsLabel.getDisplay().getSystemColor(
        filter.hasStringArguments() ? SWT.COLOR_BLACK : SWT.COLOR_GRAY);
    argumentsLabel.setForeground(color);
  }
}

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

private void statusMessage(boolean error, String message) {
  fStatusLabel.setText(message);

  if (error)
    fStatusLabel.setForeground(JFaceColors.getErrorText(fStatusLabel.getDisplay()));
  else
    fStatusLabel.setForeground(null);

  if (error)
    getShell().getDisplay().beep();
}

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

@Override
public void updateLabel() {
  if (Display.getCurrent() != null) {
    super.updateLabel();
  } else {
    fLabel.getDisplay().asyncExec(() -> {
      if (!fLabel.isDisposed()) {
        super.updateLabel();
      }
    });
  }
}

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

@Override
  public void internalWorked(double work) {
    if (Display.getCurrent() != null) {
      super.internalWorked(work);
    } else {
      fLabel.getDisplay().asyncExec(() -> {
        if (!fLabel.isDisposed()) {
          super.internalWorked(work);
        }
      });
    }
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text

private void createStatusLabel(final String statusFieldText, Color foreground, Color background) {
  fStatusLabel= new Label(fStatusComposite, SWT.RIGHT);
  fStatusLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
  fStatusLabel.setText(statusFieldText);
  FontData[] fontDatas= JFaceResources.getDialogFont().getFontData();
  for (FontData fontData : fontDatas) {
    fontData.setHeight(fontData.getHeight() * 9 / 10);
  }
  fStatusLabelFont= new Font(fStatusLabel.getDisplay(), fontDatas);
  fStatusLabel.setFont(fStatusLabelFont);
  setStatusLabelColors(foreground, background);
  setColor(fStatusComposite, foreground, background);
}

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

@Override
public void setMessage(String message) {
  super.setMessage(message);
  if (statusMessageLabel != null) {
    if (message == null) {
      statusMessageLabel.setText("");//$NON-NLS-1$
      statusMessageLabel.setToolTipText("");//$NON-NLS-1$
      getOkButton().setEnabled(true);
    } else {
      statusMessageLabel.setForeground(JFaceColors
          .getErrorText(statusMessageLabel.getDisplay()));
      statusMessageLabel.setText(message);
      statusMessageLabel.setToolTipText(message);
      getOkButton().setEnabled(false);
    }
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

private void createStatusLabel(final String statusFieldText, Color foreground, Color background) {
  fStatusLabel= new Label(fStatusComposite, SWT.RIGHT);
  fStatusLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
  fStatusLabel.setText(statusFieldText);
  FontData[] fontDatas= JFaceResources.getDialogFont().getFontData();
  for (int i= 0; i < fontDatas.length; i++) {
    fontDatas[i].setHeight(fontDatas[i].getHeight() * 9 / 10);
  }
  fStatusLabelFont= new Font(fStatusLabel.getDisplay(), fontDatas);
  fStatusLabel.setFont(fStatusLabelFont);
  
  fStatusLabelForeground= new Color(fStatusLabel.getDisplay(), Colors.blend(background.getRGB(), foreground.getRGB(), 0.56f));
  setColor(fStatusLabel, fStatusLabelForeground, background);
  setColor(fStatusComposite, foreground, background);
}

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

protected void
  copyToClipboard()
  {
    new Clipboard(control_val_pk.getDisplay()).setContents(new Object[] {control_val_pk.getData( "key" )}, new Transfer[] {TextTransfer.getInstance()});
  }
});

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

public static void makeLinkedLabel(Label label, Runnable runnable) {
    
    label.setCursor(label.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
    label.setForeground(Colors.blue);
    label.addMouseListener(new MouseAdapter() {
     @Override
     public void mouseDoubleClick(MouseEvent arg0) {
       runnable.run();
     }
     @Override
     public void mouseUp(MouseEvent arg0) {
       runnable.run();
     }
    });
  }
}

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

@Override
  public void mouseUp(MouseEvent e) {
    boolean vis = !config.getBooleanParameter(keys[f_i] + ".vis", true );
    config.setParameter(keys[f_i] + ".vis", vis );
    listener.visibilityChange( vis, f_i );
    lblDesc.setForeground(vis?Colors.getSystemColor(lblDesc.getDisplay(), SWT.COLOR_BLACK ):Colors.grey );
  }
});

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench.texteditor

/**
 * Sets the given status message in the status line.
 *
 * @param error <code>true</code> if it is an error
 * @param message the error message
 */
private void statusMessage(boolean error, String message) {
  fStatusLabel.setText(message);
  if (error)
    fStatusLabel.setForeground(JFaceColors.getErrorText(fStatusLabel.getDisplay()));
  else
    fStatusLabel.setForeground(null);
  IEditorStatusLine statusLine= getStatusLineManager();
  if (statusLine != null)
    statusLine.setMessage(error, message, null);
  if (error)
    getShell().getDisplay().beep();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text

private void setStatusLabelColors(Color foreground, Color background) {
  if (foreground == null || background == null) return;
  if (fStatusLabelForeground != null) {
    fStatusLabelForeground.dispose();
  }
  fStatusLabelForeground = new Color(fStatusLabel.getDisplay(), Colors.blend(background.getRGB(), foreground.getRGB(), 0.56f));
  fStatusLabel.setForeground(fStatusLabelForeground);
  fStatusLabel.setBackground(background);
}

代码示例来源:origin: ystrot/glance

protected void applyFonts(final Composite composite) {
  Dialog.applyDialogFont(composite);
  if (info != null) {
    final Font font = info.getFont();
    final FontData[] fontDatas = font.getFontData();
    for (int i = 0; i < fontDatas.length; i++) {
      fontDatas[i].setHeight(fontDatas[i].getHeight() * 9 / 10);
    }
    infoFont = new Font(info.getDisplay(), fontDatas);
    info.setFont(infoFont);
  }
}

相关文章