javax.swing.JLabel.createImage()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(139)

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

JLabel.createImage介绍

暂无

代码示例

代码示例来源:origin: uk.org.mygrid.taverna.scufl/scufl-ui

public JComponent getComponent(RendererRegistry renderers,
                  DataThing dataThing)
  {
    Object data = dataThing.getDataObject();
    if(data instanceof byte[]) {
      ImageIcon theImage = new ImageIcon((byte[]) data);
      return new JLabel(theImage);
    } else if(data instanceof ImageProducer) {
      JLabel label = new JLabel();
      java.awt.Image image = label.createImage((ImageProducer) data);
      ImageIcon icon = new ImageIcon(image);
      label.setIcon(icon);
      return label;
    }

    return null;
  }
}

代码示例来源:origin: net.sf.taverna.t2/renderers-impl

public JComponent getComponent(ReferenceService referenceService,
      T2Reference reference) throws RendererException {
    Object data = null;
    try {
      data = referenceService.renderIdentifier(reference, byte[].class,
          null);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    if (data instanceof byte[]) {
      // JLabel or something else?
      try {
        ImageIcon theImage = new ImageIcon((byte[]) data);
        return new JLabel(theImage);
      } catch (Exception e) {
        throw new RendererException("Unable to generate image", e);
      }
    } else if (data instanceof ImageProducer) {
      JLabel label = new JLabel();
      java.awt.Image image = label.createImage((ImageProducer) data);
      ImageIcon icon = new ImageIcon(image);
      label.setIcon(icon);
      return label;
    }

    return null;
  }
}

代码示例来源:origin: jpcsp/jpcsp

int abgr[] = new int[size];
H264Utils.YUV2ARGB(width, height, luma, cb, cr, abgr);
image = display.createImage(new MemoryImageSource(videoWidth, videoHeight, abgr, 0, width));

代码示例来源:origin: jpcsp/jpcsp

image = display.createImage(new MemoryImageSource(videoWidth, videoHeight, abgr, 0, width));

相关文章

JLabel类方法