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

x33g5p2x  于2022-01-18 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(227)

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

Canvas介绍

[英]Instances of this class provide a surface for drawing arbitrary graphics. Styles: (none) Events: (none)

This class may be subclassed by custom control implementors who are building controls that are not constructed from aggregates of other controls. That is, they are either painted using SWT graphics calls or are handled by native methods.
[中]此类的实例提供用于绘制任意图形的曲面。样式:(无)事件:(无)
此类可以由自定义控件实现者进行子类化,这些自定义控件实现者正在生成由其他控件的集合而不是构造的控件。也就是说,它们要么使用SWT图形调用绘制,要么由本机方法处理。

代码示例

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

  1. public void widgetSelected( SelectionEvent arg0 ) {
  2. tabColor.dispose();
  3. tabColorRGB = new RGB( ConstUI.COLOR_TAB_RED, ConstUI.COLOR_TAB_GREEN, ConstUI.COLOR_TAB_BLUE );
  4. tabColor = new Color( display, tabColorRGB );
  5. wTabColor.setBackground( tabColor );
  6. wTabColor.redraw();
  7. }
  8. } );

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

  1. canvas = new Canvas( metricsComposite, SWT.NONE );
  2. spoon.props.setLook( canvas );
  3. FormData fdCanvas = new FormData();
  4. fdCanvas.top = new FormAttachment( 0, 0 );
  5. fdCanvas.bottom = new FormAttachment( 100, 0 );
  6. canvas.setLayoutData( fdCanvas );
  7. canvas.addPaintListener( new PaintListener() {
  8. canvas.addMouseListener( new MouseAdapter() {
  9. @Override
  10. public void mouseDown( MouseEvent event ) {
  11. canvas.addControlListener( new ControlAdapter() {

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

  1. void refreshDifference() {
  2. Display display = canvas.getDisplay();
  3. DeviceData info = display.getDeviceData();
  4. if ( !info.tracking ) {
  5. Shell shell = canvas.getShell();
  6. MessageBox dialog = new MessageBox( shell, SWT.ICON_WARNING | SWT.OK );
  7. dialog.setText( shell.getText() );
  8. list.removeAll();
  9. text.setText( "" );
  10. canvas.redraw();
  11. for ( int i = 0; i < objects.length; i++ ) {
  12. list.add( objects[i].toString() );

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

  1. public boolean setFocus() {
  2. return ( canvas != null && !canvas.isDisposed() ) ? canvas.setFocus() : false;
  3. }

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

  1. public void redraw() {
  2. if ( isDisposed() || canvas.isDisposed() ) {
  3. return;
  4. }
  5. canvas.redraw();
  6. setZoomLabel();
  7. }

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

  1. canvas = new Canvas( sashForm, SWT.V_SCROLL | SWT.H_SCROLL | SWT.NO_BACKGROUND | SWT.BORDER );
  2. selectedNote = null;
  3. hori = canvas.getHorizontalBar();
  4. vert = canvas.getVerticalBar();
  5. canvas.addPaintListener( new PaintListener() {
  6. public void paintControl( PaintEvent e ) {
  7. JobGraph.this.paintControl( e );
  8. lastclick = null;
  9. canvas.addMouseListener( this );
  10. canvas.addMouseMoveListener( this );
  11. canvas.addMouseTrackListener( this );
  12. canvas.addMouseWheelListener( this );
  13. canvas.addKeyListener( this );

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

  1. stepsList.setLayoutData( fdStepsList );
  2. canvas = new Canvas( perfComposite, SWT.NONE );
  3. spoon.props.setLook( canvas );
  4. FormData fdCanvas = new FormData();
  5. fdCanvas.top = new FormAttachment( 0, Const.MARGIN );
  6. fdCanvas.bottom = new FormAttachment( 100, 0 );
  7. canvas.setLayoutData( fdCanvas );
  8. canvas.addPaintListener( new PaintListener() {

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

  1. @Override
  2. public void setToolTipText( String string ) {
  3. super.setToolTipText( string );
  4. appToolTipText = super.getToolTipText();
  5. }

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

  1. @Override
  2. public void runSupport() {
  3. if (canvas != null && !canvas.isDisposed()) {
  4. canvas.redraw();
  5. canvas.update();
  6. }
  7. }
  8. });

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

  1. wFFont = new Canvas( wLookComp, SWT.BORDER );
  2. props.setLook( wFFont );
  3. FormData fdFFont = new FormData();
  4. fdFFont.top = new FormAttachment( 0, margin );
  5. fdFFont.bottom = new FormAttachment( 0, h );
  6. wFFont.setLayoutData( fdFFont );
  7. wFFont.addPaintListener( new PaintListener() {
  8. public void paintControl( PaintEvent pe ) {
  9. pe.gc.setFont( fixedFont );
  10. wGFont = new Canvas( wLookComp, SWT.BORDER );
  11. props.setLook( wGFont );
  12. FormData fdGFont = new FormData();
  13. fdGFont.top = new FormAttachment( 0, nr * h + margin );
  14. fdGFont.bottom = new FormAttachment( 0, ( nr + 1 ) * h + margin );
  15. wGFont.setLayoutData( fdGFont );
  16. wGFont.addPaintListener( new PaintListener() {
  17. public void paintControl( PaintEvent pe ) {
  18. pe.gc.setFont( graphFont );
  19. wNFont = new Canvas( wLookComp, SWT.BORDER );
  20. props.setLook( wNFont );
  21. FormData fdNFont = new FormData();
  22. fdNFont.top = new FormAttachment( 0, nr * h + margin );
  23. fdNFont.bottom = new FormAttachment( 0, ( nr + 1 ) * h + margin );
  24. wNFont.setLayoutData( fdNFont );

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

  1. /**
  2. * Sets the background color of this column.
  3. *
  4. * @param background the background color
  5. */
  6. public void setBackground(Color background) {
  7. fBackground= background;
  8. if (fCanvas != null && !fCanvas.isDisposed())
  9. fCanvas.setBackground(getBackground(fCanvas.getDisplay()));
  10. }

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

  1. public void deselect() {
  2. // hide the popup
  3. // fHoverManager.disposeInformationControl();
  4. // deselect
  5. fSelection= null;
  6. resetViewerBackground(oldStyles);
  7. oldStyles= null;
  8. Display disp= fShell.getDisplay();
  9. canvas.setCursor(null);
  10. // TODO: remove shading - for now: set standard background
  11. canvas.setBackground(disp.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
  12. }

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

  1. public void widgetSelected( SelectionEvent se ) {
  2. Slider sl = (Slider) se.widget;
  3. scale = sl.getSelection();
  4. wCanvas.redraw();
  5. }
  6. } );

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

  1. private Composite createFontPreviewControl() {
  2. fontSampler = new Canvas(previewComposite, SWT.NONE);
  3. GridLayout gridLayout = new GridLayout();
  4. gridLayout.marginWidth = 0;
  5. gridLayout.marginHeight = 0;
  6. fontSampler.setLayout(gridLayout);
  7. fontSampler.setLayoutData(new GridData(GridData.FILL_BOTH));
  8. fontSampler.addPaintListener(e -> {
  9. if (currentFont != null) // do the font preview
  10. paintFontSample(e.gc);
  11. });
  12. return fontSampler;
  13. }

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

  1. @Override
  2. public void setFont( Font font ) {
  3. super.setFont( font );
  4. }

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

  1. public void setCursor(Cursor c) {
  2. super.setCursor(c);
  3. label.setCursor(c);
  4. }

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

  1. @Override
  2. public void imageDownloaded(Image image, String key, boolean returnedImmediately) {
  3. if (!returnedImmediately) {
  4. if (lblImage.isDisposed()) {
  5. return;
  6. }
  7. lblImage.setData("Image", image);
  8. Rectangle bounds = image.getBounds();
  9. GridData gridData = (GridData) lblImage.getLayoutData();
  10. gridData.heightHint = bounds.height + 10;
  11. gridData.widthHint = bounds.width + 16;
  12. lblImage.setLayoutData(gridData);
  13. lblImage.getShell().layout(new Control[] {
  14. lblImage
  15. });
  16. Point computeSize = shell.computeSize(600, SWT.DEFAULT, true);
  17. shell.setSize(computeSize);
  18. }
  19. }
  20. });

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

  1. /**
  2. * Returns the Shell in which the PaintSurface resides.
  3. * @return the Shell
  4. */
  5. public Shell getShell() {
  6. return paintCanvas.getShell();
  7. }

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

  1. public Control createControl(Composite composite)
  2. {
  3. Canvas canvas = new Canvas(composite, SWT.NONE);
  4. canvas.setBackground(ColorConstants.white);
  5. setControl(canvas);
  6. return getControl();
  7. }

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

  1. @Override
  2. public void setFont(Font font) {
  3. fFont= font;
  4. if (fCanvas != null && !fCanvas.isDisposed()) {
  5. fCanvas.setFont(fFont);
  6. updateNumberOfDigits();
  7. computeIndentations();
  8. }
  9. }

相关文章

Canvas类方法