Java 类java.awt.Image 实例源码

项目:geomapapp    文件:Icons.java   
public static XBIcon getDisabledIcon(int which, boolean selected) {
    if( which<0 || which>=disIcons.length ) return getDefaultIcon(selected);
    int i = selected ? 1 : 0;
    if( disIcons[which][i]!=null )return disIcons[which][i];
    int i1 = (i+1)%2;
    if( disIcons[which][i1]!=null ) {
        disIcons[which][i] = new XBIcon(disIcons[which][i1].getImage(), selected);
        return disIcons[which][i];
    }

    try {
        if( loader==null ) {
            loader = org.geomapapp.util.Icons.class.getClassLoader();
        }
        String path = "org/geomapapp/resources/icons/" +names[which];
        java.net.URL url = loader.getResource(path);
        BufferedImage im = ImageIO.read(url);
        Image im1 = GrayFilter.createDisabledImage(im);
        Graphics g = im.createGraphics();
        g.drawImage(im1,0,0, new JPanel() );
        disIcons[which][i] = new XBIcon(im, selected);
    } catch(Exception ex) {
        return getDefaultIcon(selected);
    }
    return disIcons[which][i];
}
项目:openjdk-jdk10    文件:PeekGraphics.java   
private synchronized void waitForDimensions(Image img) {
    mHeight = img.getHeight(this);
    mWidth = img.getWidth(this);
    while (!badImage && (mWidth < 0 || mHeight < 0)) {
        try {
            Thread.sleep(50);
        } catch(InterruptedException e) {
            // do nothing.
        }
        mHeight = img.getHeight(this);
        mWidth = img.getWidth(this);
    }
    if (badImage) {
        mHeight = 0;
        mWidth = 0;
    }
}
项目:Lernkartei_2017    文件:SpriteManager.java   
public SpriteManager(String p, int tw, int th, int n,boolean l)
{
    loop = l;
    maxIms = n;
    index = 0;
    count = 0;
    delay = 10;

    currFrame = 0;
    ims = new Image[n];

    try
    {
        BufferedImage tIm = ImageIO.read(new File(p));            
        for (int i = 0; i < n; i++)
        {
            add(tIm.getSubimage(i*tw, 0, tw, th));
        }
    }
    catch(IOException e)
    {
        e.printStackTrace();
    }        
}
项目:incubator-netbeans    文件:WindowBuilders.java   
FrameBuilder(Instance instance, Heap heap) {
    super(instance, heap);

    title = Utils.getFieldString(instance, "title");
    undecorated = DetailsUtils.getBooleanFieldValue(instance, "undecorated", false);

    Image _image = null;
    Object icons = instance.getValueOfField("icons");
    if (icons instanceof Instance) {
        Instance i = (Instance)icons;
        if (DetailsUtils.getIntFieldValue(i, "size", 0) > 0) {
            Object elementData = i.getValueOfField("elementData");
            if (elementData instanceof ObjectArrayInstance) {
                Object o = ((ObjectArrayInstance)elementData).getValues().get(0);
                _image = o != null ? ImageBuilder.buildImage((Instance)o, heap) : null;
            }
        }
    }
    image = _image;
}
项目:openjdk-jdk10    文件:SunGraphics2D.java   
/**
 * Not part of the advertised API but a useful utility method
 * to call internally.  This is for the case where we are
 * drawing to/from given coordinates using a given width/height,
 * but we guarantee that the surfaceData's width/height of the src and dest
 * areas are equal (no scale needed). Note that this method intentionally
 * ignore scale factor of the source image, and copy it as is.
 */
public boolean copyImage(Image img, int dx, int dy, int sx, int sy,
                         int width, int height, Color bgcolor,
                         ImageObserver observer) {
    try {
        return imagepipe.copyImage(this, img, dx, dy, sx, sy,
                                   width, height, bgcolor, observer);
    } catch (InvalidPipeException e) {
        try {
            revalidateAll();
            return imagepipe.copyImage(this, img, dx, dy, sx, sy,
                                       width, height, bgcolor, observer);
        } catch (InvalidPipeException e2) {
            // Still catching the exception; we are not yet ready to
            // validate the surfaceData correctly.  Fail for now and
            // try again next time around.
            return false;
        }
    } finally {
        surfaceData.markDirty();
    }
}
项目:SpotSpotter    文件:BMPReader.java   
protected static Image readImage32(FileInputStream fs, BitmapHeader bh) throws IOException {
    Image image;
    final int ndata[] = new int[bh.iHeight * bh.iWidth];
    final byte brgb[] = new byte[bh.iWidth * 4 * bh.iHeight];
    fs.read(brgb, 0, bh.iWidth * 4 * bh.iHeight);
    int nindex = 0;
    for (int j = 0; j < bh.iHeight; j++) {
        for (int i = 0; i < bh.iWidth; i++) {
            ndata[bh.iWidth * (bh.iHeight - j - 1) + i] = constructInt3(brgb, nindex);
            nindex += 4;
        }
    }
    image = Toolkit.getDefaultToolkit()
            .createImage(new MemoryImageSource(bh.iWidth, bh.iHeight, ndata, 0, bh.iWidth));
    fs.close();
    return (image);
}
项目:openjdk-jdk10    文件:RuntimeBuiltinLeafInfoImpl.java   
private BufferedImage convertToBufferedImage(Image image) throws IOException {
    if (image instanceof BufferedImage) {
        return (BufferedImage)image;

    } else {
        MediaTracker tracker = new MediaTracker(new Component(){}); // not sure if this is the right thing to do.
        tracker.addImage(image, 0);
        try {
            tracker.waitForAll();
        } catch (InterruptedException e) {
            throw new IOException(e.getMessage());
        }
        BufferedImage bufImage = new BufferedImage(
                image.getWidth(null),
                image.getHeight(null),
                BufferedImage.TYPE_INT_ARGB);

        Graphics g = bufImage.createGraphics();
        g.drawImage(image, 0, 0, null);
        return bufImage;
    }
}
项目:incubator-netbeans    文件:SearchScopeNodeSelection.java   
@Override
public Icon getIcon() {
    Node[] nodes = getNodes();
    if (nodes.length > 1) {
        return MULTI_SELECTION_ICON;
    } else if (nodes.length == 1 && nodes[0] != null) {
        Node n = nodes[0];
        Image image = n.getIcon(BeanInfo.ICON_COLOR_16x16);
        if (image != null) {
            return ImageUtilities.image2Icon(image);
        } else {
            return null;
        }
    } else {
        return null;
    }
}
项目:jdk8u-jdk    文件:PeekGraphics.java   
synchronized private void waitForDimensions(Image img) {
    mHeight = img.getHeight(this);
    mWidth = img.getWidth(this);
    while (!badImage && (mWidth < 0 || mHeight < 0)) {
        try {
            Thread.sleep(50);
        } catch(InterruptedException e) {
            // do nothing.
        }
        mHeight = img.getHeight(this);
        mWidth = img.getWidth(this);
    }
    if (badImage) {
        mHeight = 0;
        mWidth = 0;
    }
}
项目:openjdk-jdk10    文件:SurfaceManager.java   
/**
 * Returns the SurfaceManager object contained within the given Image.
 */
public static SurfaceManager getManager(Image img) {
    SurfaceManager sMgr = imgaccessor.getSurfaceManager(img);
    if (sMgr == null) {
        /*
         * In practice only a BufferedImage will get here.
         */
        try {
            BufferedImage bi = (BufferedImage) img;
            sMgr = new BufImgSurfaceManager(bi);
            setManager(bi, sMgr);
        } catch (ClassCastException e) {
            throw new IllegalArgumentException("Invalid Image variant");
        }
    }
    return sMgr;
}
项目:incubator-netbeans    文件:JFXProjectIconAnnotator.java   
@Override
@NonNull
public Image annotateIcon(
        @NonNull final Project p,
        @NonNull Image original,
        final boolean openedNode) {
    Boolean type = projectType.get(p);
    if (type != null) {
        if(type.booleanValue() == true) {
            final Image badge = getJFXBadge();
            if (badge != null) {
                original = ImageUtilities.mergeImages(original, badge, 8, 8);
            }
        }
    } else {
        evaluateProjectType(p);
    }
    return original;
}
项目:incubator-netbeans    文件:TextImporterUI.java   
private Icon readIconFromFile( File iconFile ) {
    try {
        Image img = ImageIO.read( iconFile.toURL() );
        if( null != img ) {
            ImageIcon res = new ImageIcon( img );
            if( res.getIconWidth() > 32 || res.getIconHeight() > 32 )  {
                JOptionPane.showMessageDialog(this, NbBundle.getMessage(TextImporterUI.class, "Err_IconTooBig"), //NOI18N
                        NbBundle.getMessage(TextImporterUI.class, "Err_Title"), JOptionPane.ERROR_MESSAGE  ); //NOI18N
                return null;
            }
            return res;
        }
    } catch( ThreadDeath td ) {
        throw td;
    } catch( Throwable ioE ) {
        //ignore
    }
    JOptionPane.showMessageDialog(this, 
            NbBundle.getMessage(TextImporterUI.class, "Err_CannotLoadIconFromFile", iconFile.getName()), //NOI18N
            NbBundle.getMessage(TextImporterUI.class, "Err_Title"), JOptionPane.ERROR_MESSAGE  ); //NOI18N
    return null;
}
项目:JavaPPTX    文件:PPPicture.java   
private static byte[] convertToPNG(Image image) {
   ByteArrayOutputStream out = new ByteArrayOutputStream();
   int width = image.getWidth(null);
   int height = image.getHeight(null);
   BufferedImage bi = new BufferedImage(width, height,
                                        BufferedImage.TYPE_INT_ARGB);
   Graphics2D g = bi.createGraphics();
   g.setComposite(AlphaComposite.Src);
   g.drawImage(image, 0, 0, null);
   g.dispose();
   ImageOutputStream ios = new MemoryCacheImageOutputStream(out);
   try {
      if (!ImageIO.write(bi, "PNG", ios)) {
         throw new IOException("ImageIO.write failed");
      }
      ios.close();
   } catch (IOException ex) {
      throw new RuntimeException("saveImage: " + ex.getMessage());
   }
   return out.toByteArray();
}
项目:OpenJSharp    文件:FileSystemView.java   
/**
 * Icon for a file, directory, or folder as it would be displayed in
 * a system file browser. Example from Windows: the "M:\" directory
 * displays a CD-ROM icon.
 *
 * The default implementation gets information from the ShellFolder class.
 *
 * @param f a <code>File</code> object
 * @return an icon as it would be displayed by a native file chooser
 * @see JFileChooser#getIcon
 * @since 1.4
 */
public Icon getSystemIcon(File f) {
    if (f == null) {
        return null;
    }

    ShellFolder sf;

    try {
        sf = getShellFolder(f);
    } catch (FileNotFoundException e) {
        return null;
    }

    Image img = sf.getIcon(false);

    if (img != null) {
        return new ImageIcon(img, sf.getFolderType());
    } else {
        return UIManager.getIcon(f.isDirectory() ? "FileView.directoryIcon" : "FileView.fileIcon");
    }
}
项目:jdk8u-jdk    文件:ToolkitImage.java   
/**
 * Return a property of the image by name.  Individual property names
 * are defined by the various image formats.  If a property is not
 * defined for a particular image, then this method will return the
 * UndefinedProperty object.  If the properties for this image are
 * not yet known, then this method will return null and the ImageObserver
 * object will be notified later.  The property name "comment" should
 * be used to store an optional comment which can be presented to
 * the user as a description of the image, its source, or its author.
 */
public Object getProperty(String name, ImageObserver observer) {
    if (name == null) {
        throw new NullPointerException("null property name is not allowed");
    }

    if (src != null) {
        src.checkSecurity(null, false);
    }
    if (properties == null) {
        addWatcher(observer, true);
        if (properties == null) {
            return null;
        }
    }
    Object o = properties.get(name);
    if (o == null) {
        o = Image.UndefinedProperty;
    }
    return o;
}
项目:Sensors    文件:Interface.java   
public JButton getButtonNew(ArrayList<Double> lista,ArrayList<String>ScannerName,JLabel label, ThreadServer threadServer){
JButton btnNew = new JButton(new ImageIcon(((new ImageIcon("images/graph.png")).getImage()).getScaledInstance(30, 30, java.awt.Image.SCALE_SMOOTH)));


//  JButton btnNew = new JButton(new ImageIcon("images/graph.png") );

    //lblNew.setMaximumSize(new Dimension(10000, 50));      
    btnNew.setBounds(150,26+actualheight, 30, 30);
    frame.getContentPane().add(btnNew);
    //actualheight+=50;
    btnNew.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
          String name=ScannerName.get(0);
        // display/center the jdialog when the button is pressed
          JFrame f = new JFrame(name);

        //  f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.add(new GraphingData(lista,name));
            f.setSize(400,400);
            f.setLocation(200,200);
            f.setVisible(true);
      }
    });
    btnNew.setVisible(true);
    frame.invalidate();
    frame.validate();
    frame.repaint();
    return btnNew;
}
项目:hearthstone    文件:Img.java   
/**
 * Redimensiona a imagem do caminho passado por parâmetro
 *
 * @param image imagem
 * @param new_w nova largura
 * @param new_h nova altura
 * @return retorna a imagem redimensionada
 */
public static ImageIcon redimensionaImg(Image image, int new_w, int new_h) {
    BufferedImage new_img = new BufferedImage(new_w, new_h, BufferedImage.TYPE_INT_ARGB);
    Graphics2D g = new_img.createGraphics();
    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
    g.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
    g.drawImage(image, 0, 0, new_w, new_h, null);
    g.dispose();
    return new ImageIcon(new_img);
}
项目:openjdk-jdk10    文件:MultiResolutionRenderingHintsTest.java   
private static Color getImageColor(final Object renderingHint, Image image,
        double configScale, double graphicsScale) {

    int width = image.getWidth(null);
    int height = image.getHeight(null);

    TestSurfaceData surface = new TestSurfaceData(width, height, configScale);
    SunGraphics2D g2d = new SunGraphics2D(surface,
            Color.BLACK, Color.BLACK, null);
    g2d.setRenderingHint(KEY_RESOLUTION_VARIANT, renderingHint);
    g2d.scale(graphicsScale, graphicsScale);
    g2d.drawImage(image, 0, 0, null);
    g2d.dispose();
    return surface.getColor(width / 2, height / 2);
}
项目:SER316-Ingolstadt    文件:ImagePreview.java   
public void loadImage() {
    if (file == null) {
        return;
    }

    ImageIcon tmpIcon = new ImageIcon(file.getPath());
    if (tmpIcon.getIconWidth() > 90) {
        thumbnail = new ImageIcon(tmpIcon.getImage().
                             getScaledInstance(90, -1,
                                               Image.SCALE_DEFAULT));
    } else {
        thumbnail = tmpIcon;
    }
}
项目:jdk8u-jdk    文件:ValidatePipe.java   
public boolean copyImage(SunGraphics2D sg, Image img,
                         int x, int y,
                         Color bgColor,
                         ImageObserver observer) {
    if (validate(sg)) {
        return sg.imagepipe.copyImage(sg, img, x, y, bgColor, observer);
    } else {
        return false;
    }
}
项目:jdk8u-jdk    文件:XDataTransferer.java   
/**
 * Translates either a byte array or an input stream which contain
 * platform-specific image data in the given format into an Image.
 */
protected Image platformImageBytesToImage(
    byte[] bytes, long format) throws IOException
{
    String mimeType = null;
    if (format == PNG_ATOM.getAtom()) {
        mimeType = "image/png";
    } else if (format == JFIF_ATOM.getAtom()) {
        mimeType = "image/jpeg";
    } else {
        // Check if an image MIME format.
        try {
            String nat = getNativeForFormat(format);
            DataFlavor df = new DataFlavor(nat);
            String primaryType = df.getPrimaryType();
            if ("image".equals(primaryType)) {
                mimeType = df.getPrimaryType() + "/" + df.getSubType();
            }
        } catch (Exception e) {
            // Not an image MIME format.
        }
    }
    if (mimeType != null) {
        return standardImageBytesToImage(bytes, mimeType);
    } else {
        String nativeFormat = getNativeForFormat(format);
        throw new IOException("Translation from " + nativeFormat +
                              " is not supported.");
    }
}
项目:Lernkartei_2017    文件:SpriteManager.java   
public Image get(int i)
{
    if ((i >= 0) && (i < index))
    {
        return ims[i];
    } else if (index > 0)
    {
        return ims[0];
    } else
    {
        return null;
    }
}
项目:parabuild-ci    文件:ImageTitle.java   
/**
 * Sets the image for the title and notifies registered listeners that the
 * title has been modified.
 *
 * @param image  the new image (<code>null</code> not permitted).
 */
public void setImage(Image image) {

    if (image == null) {
        throw new NullPointerException("ImageTitle.setImage (..): Image must not be null.");
    }
    this.image = image;
    notifyListeners(new TitleChangeEvent(this));

}
项目:incubator-netbeans    文件:TopComponentDragSupport.java   
/**
 * @return An invisible (size 1x1) image to be used for dragging to replace 
 * the default one supplied by the operating system (if any).
 */
private Image createDragImage() {
    GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment()
                .getDefaultScreenDevice().getDefaultConfiguration();

    BufferedImage res = config.createCompatibleImage(1, 1);
    Graphics2D g = res.createGraphics();
    g.setColor( Color.white );
    g.fillRect(0,0,1,1);
    return res;
}
项目:OpenJSharp    文件:DrawImage.java   
protected BufferedImage getBufferedImage(Image img) {
    if (img instanceof BufferedImage) {
        return (BufferedImage)img;
    }
    // Must be VolatileImage; get BufferedImage representation
    return ((VolatileImage)img).getSnapshot();
}
项目:AjouMedia_Register    文件:ImageHelper.java   
private PImage imageReader(String fileName) {

        Image img = null;
        try {
            File sourceimage = new File(path.getAbsolutePath() + "\\image\\" + fileName);
            img = ImageIO.read(sourceimage);

        } catch (IOException e) {
        }

        PImage image = new PImage(img);
        return image;
    }
项目:freecol    文件:UnitImageAnimation.java   
/**
 * {@inheritDoc}
 */
public void executeWithUnitOutForAnimation(JLabel unitLabel) {
    final GUI gui = getGUI();

    // Tile position should now be valid.
    if (gui.getTilePosition(this.tile) == null) {
        logger.warning("Failed attack animation for " + this.unit
            + " at tile: " + this.tile);
        return;
    }

    final Rectangle rect = gui.getTileBounds(this.tile);
    final ImageIcon icon = (ImageIcon)unitLabel.getIcon();
    for (AnimationEvent event : animation) {
        long time = System.nanoTime();
        if (event instanceof ImageAnimationEvent) {
            final ImageAnimationEvent ievent = (ImageAnimationEvent)event;
            Image image = ievent.getImage();
            if (mirror) {
                // FIXME: Add mirroring functionality to SimpleZippedAnimation
                image = ImageLibrary.createMirroredImage(image);
            }
            icon.setImage(image);
            gui.paintImmediatelyCanvasIn(rect);
            time = ievent.getDurationInMs()
                - (System.nanoTime() - time) / 1000000;
            if (time > 0) Utils.delay(time, "Animation delayed.");
        }
    }
    gui.refresh();
}
项目:OpenJSharp    文件:DrawImage.java   
public boolean copyImage(SunGraphics2D sg, Image img,
                         int x, int y,
                         Color bgColor,
                         ImageObserver observer) {
    if (!(img instanceof ToolkitImage)) {
        return copyImage(sg, img, x, y, bgColor);
    } else {
        ToolkitImage sunimg = (ToolkitImage)img;
        if (!imageReady(sunimg, observer)) {
            return false;
        }
        ImageRepresentation ir = sunimg.getImageRep();
        return ir.drawToBufImage(sg, sunimg, x, y, bgColor, observer);
    }
}
项目:amelia    文件:AuthorizeGoogleUser.java   
private static void downloadProfileImage(String picture,String name){
      Image image = null;
      try {
          URL url = new URL(picture);
          image = ImageIO.read(url);
          BufferedImage bimg = toBufferedImage(image);
          ImageIO.write(bimg, "PNG", new File(LocalEnvironment.getLocalVar(Local.TMP)+File.separator+name+".png"));
      } catch (IOException e) {
          System.err.println(e);
      }

}
项目:parabuild-ci    文件:ImageTitle.java   
/**
 * Creates a new image title.
 *
 * @param image  the image.
 */
public ImageTitle(Image image) {

    this(image,
         image.getHeight(null),
         image.getWidth(null),
         Title.DEFAULT_POSITION,
         Title.DEFAULT_HORIZONTAL_ALIGNMENT,
         Title.DEFAULT_VERTICAL_ALIGNMENT,
         Title.DEFAULT_SPACER);

}
项目:OpenJSharp    文件:GLXSurfaceData.java   
/**
 * Creates a SurfaceData object representing an off-screen buffer (either
 * a Pbuffer or Texture).
 */
public static GLXOffScreenSurfaceData createData(GLXGraphicsConfig gc,
                                                 int width, int height,
                                                 ColorModel cm,
                                                 Image image, int type)
{
    return new GLXOffScreenSurfaceData(null, gc, width, height,
                                       image, cm, type);
}
项目:jdk8u-jdk    文件:IncorrectClipXorModeSurface2Surface.java   
private static void draw(Shape clip, Shape shape, Image from, Image to) {
    Graphics2D g2d = (Graphics2D) to.getGraphics();
    g2d.setXORMode(Color.BLACK);
    g2d.setClip(clip);
    Rectangle toBounds = shape.getBounds();
    g2d.drawImage(from, toBounds.x, toBounds.y, toBounds.width,
                  toBounds.height, null);
    g2d.dispose();
}
项目:McLink    文件:ImageUtil.java   
public static BufferedImage resize(BufferedImage img, int newW, int newH) { 
    Image tmp = img.getScaledInstance(newW, newH, Image.SCALE_SMOOTH);
    BufferedImage dimg = new BufferedImage(newW, newH, BufferedImage.TYPE_INT_ARGB);

    Graphics2D g2d = dimg.createGraphics();
    g2d.drawImage(tmp, 0, 0, null);
    g2d.dispose();

    return dimg;
}
项目:cognitive-services-java-computer-vision-tutorial    文件:MainFrame.java   
/**
 * Scales the given image to fit the label dimensions.
 * @param bImage: The image to fit.
 * @param label: The label to display the image.
 */
private void scaleAndShowImage(BufferedImage bImage, JLabel label) {
    int bImageHeight = bImage.getHeight();
    int bImageWidth = bImage.getWidth();
    int labelHeight = label.getHeight();
    int labelWidth = label.getWidth();

    // Does this need to be scaled?
    if (labelHeight >= bImageHeight && labelWidth >= bImageWidth) {
        // If not, display the image and return.
        ImageIcon image = new ImageIcon(bImage);
        label.setIcon(image);
        return;
    }

    // Calculate the new width and height for the image.
    int newHeight;
    int newWidth;
    double bImageAspect = (double)bImageHeight / (double)bImageWidth;
    double labelAspect = (double)labelHeight / (double)labelWidth;

    if (bImageAspect > labelAspect) {
        newHeight = labelHeight;
        newWidth = (int)(((double)labelHeight / (double)bImageHeight) * (double)bImageWidth);
    } else {
        newWidth = labelWidth;
        newHeight = (int)(((double)labelWidth / (double)bImageWidth) * (double)bImageHeight);
    }

    // Create a new image scaled to the correct size.
    Image newImage = bImage.getScaledInstance(newWidth, newHeight, Image.SCALE_SMOOTH);

    // Display the scaled image.
    ImageIcon labelImage = new ImageIcon(newImage);
    label.setIcon(labelImage);
    label.validate();
    label.repaint();
}
项目:Dahlem_SER316    文件:ImagePreview.java   
public void loadImage() {
    if (file == null) {
        return;
    }

    ImageIcon tmpIcon = new ImageIcon(file.getPath());
    if (tmpIcon.getIconWidth() > 90) {
        thumbnail = new ImageIcon(tmpIcon.getImage().
                             getScaledInstance(90, -1,
                                               Image.SCALE_DEFAULT));
    } else {
        thumbnail = tmpIcon;
    }
}
项目:incubator-netbeans    文件:MultiModuleNodeFactory.java   
private Image computeIcon(boolean opened, int type) {
    Image image = opened ?
            getDataFolderNodeDelegate().getOpenedIcon(type) :
            getDataFolderNodeDelegate().getIcon(type);
    image = ImageUtilities.mergeImages(
            image,
            ImageUtilities.loadImage(TEST_BADGE),
            4, 5);
    return image;
}
项目:QN-ACTR-Release    文件:JMTImageLoader.java   
/**  Loads the image from this directory, please put all images in the class
 * package.
 *
 * @param imageName string containing the image name
 * @return the image
 */
public static Image loadImageAwt(String imageName) {
    ImageIcon img = imageLoader.loadIcon(imageName);
    if (img != null) {
        return img.getImage();
    } else {
        return null;
    }
}
项目:dracoon-dropzone    文件:SettingsDialog.java   
/**
 * Creates the header of the settings dialog
 * 
 * @return
 */
private JPanel createHeader() {
    JPanel header = new JPanel(new BorderLayout());
    header.setBorder(new EmptyBorder(0, 0, 0, 0));

    JLabel headerIcon = new JLabel();
    headerIcon.setIcon(new ImageIcon(new ImageIcon(Dropzone.class.getResource("/images/settings.png")).getImage()
            .getScaledInstance(400, 210, Image.SCALE_SMOOTH)));
    header.add(headerIcon, BorderLayout.NORTH);

    JLabel area = new JLabel();
    area.setForeground(Color.DARK_GRAY);
    final String s = "<html>" + (I18n.get("settings.infotext")) + "</html>";
    area.setText(s);

    JPanel infoWrapperPanel = new JPanel();
    infoWrapperPanel.setLayout(new BoxLayout(infoWrapperPanel, BoxLayout.Y_AXIS));

    JPanel topSpacerPanel = new JPanel();

    JPanel bottomSpacerPanel = new JPanel();

    JPanel infoTextPanel = new JPanel(new BorderLayout());
    infoTextPanel.setBorder(new EmptyBorder(0, 10, 10, 0));
    infoTextPanel.setPreferredSize(getPreferredSize(s, true, 400));
    infoTextPanel.add(area, BorderLayout.NORTH);

    infoWrapperPanel.add(topSpacerPanel);
    infoWrapperPanel.add(infoTextPanel);
    infoWrapperPanel.add(bottomSpacerPanel);

    header.add(infoWrapperPanel, BorderLayout.SOUTH);
    return header;
}
项目:jdk8u-jdk    文件:WGLSurfaceData.java   
/**
 * Creates a SurfaceData object representing an off-screen buffer (either
 * a Pbuffer or Texture).
 */
public static WGLOffScreenSurfaceData createData(WGLGraphicsConfig gc,
                                                 int width, int height,
                                                 ColorModel cm,
                                                 Image image, int type)
{
    return new WGLOffScreenSurfaceData(null, gc, width, height,
                                       image, cm, type);
}
项目:incubator-netbeans    文件:MultiViewFactory.java   
@Override
public Image getIcon() {
    if (!map.containsKey("iconBase")) {
        return null; // #206525
    }
    String base = get("iconBase", String.class); // NOI18N
    return ImageUtilities.loadImage(base, true);
}