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

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

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

Canvas.getData介绍

暂无

代码示例

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

@Override
  public void mouseUp(MouseEvent event) {
    Canvas canvas = (Canvas) event.widget;
    Thing thing = (Thing) canvas.getData();
    thing.put("drag", false);
  }
});

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

@Override
  public void widgetDisposed(DisposeEvent e) {
    String oldImageID = (String) canvas.getData("ImageID");
    if (oldImageID != null && canvas.getData("image") != null) {
      ImageLoader imageLoader = skin.getImageLoader(properties);
      imageLoader.releaseImage(oldImageID);
    }
  }
});

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

@Override
  public void paintControl(PaintEvent e) {
    int i = ((Integer)cColor.getData("Index")).intValue();
    e.gc.setBackground(blockColors[i]);
    e.gc.fillRectangle(e.x, e.y, e.width, e.height);
  }
});

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

@Override
public void mouseDown(MouseEvent event) {
  if(event.button == 1){
    Canvas canvas = (Canvas) event.widget;
    Thing thing = (Thing) canvas.getData();
    thing.put("drag", true);
    thing.put("lastX", event.x);
    thing.put("lastY", event.y);
  }
}

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

@Override
  public void mouseUp(MouseEvent e) {
    Integer iIndex = (Integer)cColor.getData("Index");
    if (iIndex == null)
      return;
    int index = iIndex.intValue();
    if (e.button == 1) {
      RGB rgb = Utils.showColorDialog( panel, blockColors[index].getRGB());
      if ( rgb != null ){
        config.setRGBParameter(keys[index], rgb.red, rgb.green, rgb.blue);
      }
    }else{
      config.removeRGBParameter(keys[index]);
    }
  }
});

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

Image imgSrc = (Image) control.getData("image");
Integer drawAlpha = (Integer) control.getData("drawAlpha");
if (drawAlpha != null) {
  e.gc.setAlpha(drawAlpha);
Long drawMode = (Long) control.getData("drawmode");
if (drawMode == DRAW_ANIMATE) {
  Image[] images = (Image[]) control.getData("images");
  if (images != null) {
   int idx = ((Number) control.getData("ImageIndex")).intValue();
   imgSrc = images[idx];
  SWTSkinObjectImage soImage = (SWTSkinObjectImage) control.getData("SkinObject");
  imageLoader = soImage.getSkin().getImageLoader(
      soImage.getProperties());
  String imageID = (String) control.getData("ImageID");
  if (imageLoader.imageExists(imageID)) {
    idToRelease = imageID;
    imgRight = (Image) control.getData("image-right");
    imgLeft = (Image) control.getData("image-left");

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

@Override
  public void paintControl(PaintEvent e) {
    Canvas can= (Canvas) e.getSource();
    Annotation a= ((Item) can.getData()).fAnnotation;
    if (a != null) {
      Rectangle rect= new Rectangle(fLayouter.getBorderWidth(), fLayouter.getBorderWidth(), fLayouter.getAnnotationSize(), fLayouter.getAnnotationSize());
      if (fAnnotationAccessExtension != null)
        fAnnotationAccessExtension.paint(a, e.gc, can, rect);
    }
  }
}

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

public void paintControl(PaintEvent e) {
    Canvas can= (Canvas) e.getSource();
    Annotation a= ((Item) can.getData()).fAnnotation;
    if (a != null) {
      Rectangle rect= new Rectangle(fLayouter.getBorderWidth(), fLayouter.getBorderWidth(), fLayouter.getAnnotationSize(), fLayouter.getAnnotationSize());
      if (fAnnotationAccessExtension != null)
        fAnnotationAccessExtension.paint(a, e.gc, can, rect);
    }
  }
}

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

@Override
  public void paintControl(PaintEvent e) {
    Canvas can= (Canvas) e.getSource();
    Annotation a= ((Item) can.getData()).fAnnotation;
    if (a != null) {
      Rectangle rect= new Rectangle(fLayouter.getBorderWidth(), fLayouter.getBorderWidth(), fLayouter.getAnnotationSize(), fLayouter.getAnnotationSize());
      if (fAnnotationAccessExtension != null)
        fAnnotationAccessExtension.paint(a, e.gc, can, rect);
    }
  }
}

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

vpadding = properties.getIntValue(sPrefix + ".v-padding", 0);
Font existingFont = (Font) canvas.getData("Font" + suffix);
if (existingFont != null && !existingFont.isDisposed()) {
  canvas.setData("font", existingFont);

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

String oldImageID = (String) canvas.getData("ImageID");
if (sImageID != null && sImageID.equals(oldImageID)) {
  return null;
if (oldImageID != null && canvas.getData("image") != null) {
  imageLoader.releaseImage(oldImageID);
boolean hasExistingDelay = canvas.getData("delay") != null;
canvas.setData("delay", null);
if (images == null) {

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

public void mouseScrolled(MouseEvent event) {				
  Canvas canvas = (Canvas) event.widget;
  Thing thing = (Thing) canvas.getData();

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

@Override
public void mouseMove(MouseEvent event) {
  Canvas canvas = (Canvas) event.widget;
  Thing thing = (Thing) canvas.getData();
  if(thing.getBoolean("drag")){
    int lastX = thing.getInt("lastX");
    int lastY = thing.getInt("lastY");
    
    int x = thing.getInt("x") + lastX - event.x;
    int y = thing.getInt("y") + lastY - event.y;
    if(x < 0){
      x = 0;
    }
    if( y < 0){
      y = 0;
    }
    thing.put("x", x);
    thing.put("y", y);
    thing.put("lastX", event.x);
    thing.put("lastY", event.y);
  }
  
  canvas.redraw();
}

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

clientArea.height -= vpadding * 2;
Font existingFont = (Font) canvas.getData("font");
Color existingColor = (Color) canvas.getData("color");

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

canvas.addPaintListener(e -> {
  Canvas c = (Canvas)e.widget;
  Image image = (Image)c.getData("IMAGE");
  if (image != null) {
    e.gc.drawImage(image, 5, 5);
  } else {
    String[] strings = (String[])c.getData("STRINGS");
    if (strings != null) {
      FontMetrics metrics = e.gc.getFontMetrics();

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

Image image = (Image) lblImage.getData("Image");
if (image != null) {
  Rectangle bounds = image.getBounds();

相关文章

Canvas类方法