Java Code Examples for javax.swing.ImageIcon#getImageLoadStatus()

The following examples show how to use javax.swing.ImageIcon#getImageLoadStatus() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File:    From defense-solutions-proofs-of-concept with Apache License 2.0 5 votes vote down vote up
public BasemapLayer(Layer layer, String thumbnailFilename) {
    this.layer = layer;
    if (null == thumbnailFilename) {
        thumbnail = null;
    } else {
        ImageIcon imageIcon = new ImageIcon(thumbnailFilename);
        thumbnail = MediaTracker.COMPLETE == imageIcon.getImageLoadStatus() ? imageIcon : null;
Example 2
Source File:    From pdfxtk with Apache License 2.0 5 votes vote down vote up
public iiuf.xmillum.Image getImage(URL imageURL) throws IOException {
  ImageIcon icon = new ImageIcon(imageURL);
  if (icon.getImageLoadStatus() == MediaTracker.ERRORED) {
    context.setStatus("Unable to load image "+imageURL);
    return null;
  return new JavaImage(icon.getImage());
Example 3
Source File:    From megamek with GNU General Public License v2.0 4 votes vote down vote up
 * Paints an edge for the border given a list of icons to paint.  We need
 * to know whether each icon should be tiled, how many tiled icons there 
 * are and how much space (width/height) needs to be filled by tiled icons.
 * @param c  The Component to pain on
 * @param g  The Graphics object to paint with 
 * @param isLeftRight Are we drawing a left or right edge?
 * @param icons The ImageIcons to draw
 * @param shouldTile  Denotes whether each icon should be tiled or not
 * @param numTiledIcons The number of tiled icons we have to draw with
 * @param staticSpace How much space needs to be filled with tiledi cons
private void paintEdge(Component c, Graphics g, ArrayList<ImageIcon> icons, 
        int x, int y, int width, int height, boolean isLeftRight,
        ArrayList<Boolean> shouldTile, int numTiledIcons, int staticSpace){       
    g = g.create(x, y, width, height);
    // Determine how much width/height a tiled icons will get to consume
    int tiledWidth = isLeftRight ? width :
            (int)((width - staticSpace + 0.0) / numTiledIcons + 0.5);
    int tiledHeight = isLeftRight ? (int) ((height - staticSpace + 0.0)
            / numTiledIcons + 0.5) : height;
    x = 0; 
    y = 0;
    // Draw each icon
    for (int i = 0; i < icons.size(); i++){
        ImageIcon icon = icons.get(i);
        if (icon.getImageLoadStatus() != MediaTracker.COMPLETE){
        if (shouldTile.get(i)){
            // Tile icons that should be tiled
            if (isLeftRight){
                y += tiledHeight;
            } else {
                x += tiledWidth;
        } else {
            // Draw static icons once
            icons.get(i).paintIcon(c, g, x, y);
            if (isLeftRight){
                y+= icon.getIconHeight();
            } else {
                x+= icon.getIconWidth();