コード例 #1
0
 /**
  * Gets the IconBox for the specified image IRI.
  *
  * @param iri The IRI pointing to the image.
  * @return The icon box containing the image.
  * @throws MalformedURLException
  */
 private IconBox getImageBox(IRI iri) throws MalformedURLException {
   ImageIcon imageIcon = new ImageIcon(iri.toURI().toURL());
   imageIcon.getImageLoadStatus();
   IconBox iconBox = new IconBox(imageIcon, new HTTPLink(iri.toURI()));
   iconBox.setMaxHeight(50);
   return iconBox;
 }
コード例 #2
0
ファイル: Intro.java プロジェクト: erpframework/scout449
 /** Loads the image. */
 public static void loadImage() {
   if (fileImage != null) return; // already loaded this
   AppLib.printDebug("Loading introduction image");
   ImageIcon fi = AppLib.loadClassImage("images/title.png");
   // wait for it...
   while (fi.getImageLoadStatus() == MediaTracker.LOADING) AppLib.sleep(20L);
   // load me!
   fileImage = fi.getImage();
   screenImage = screenShot(AppLib.winInfo.getScreenSize());
 }
コード例 #3
0
  // get an image from the given filename
  private static Image getImage(String filename) {

    // to read from file
    ImageIcon icon = new ImageIcon(filename);

    // try to read from URL
    if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) {
      try {
        URL url = new URL(filename);
        icon = new ImageIcon(url);
      } catch (Exception e) {
        /* not a url */
      }
    }

    // in case file is inside a .jar
    if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) {
      URL url = StdDraw.class.getResource(filename);
      if (url == null) throw new RuntimeException("image " + filename + " not found");
      icon = new ImageIcon(url);
    }

    return icon.getImage();
  }
コード例 #4
0
ファイル: SleepGUI.java プロジェクト: CarrKnight/SleepStone2
  protected void initializeIcon() {
    icons[0] = new ImageIcon("icons/medicine.png");
    icons[1] = new ImageIcon("icons/wine.png");
    icons[2] = new ImageIcon("icons/fertilizer.png");
    icons[3] = new ImageIcon("icons/iron.png");
    icons[4] = new ImageIcon("icons/pigiron.png");
    icons[5] = new ImageIcon("icons/steel.png");
    icons[6] = new ImageIcon("icons/tools.png");

    for (ImageIcon x : icons) {
      if (x.getImageLoadStatus() == MediaTracker.ERRORED) {
        System.out.println(x + "failed");
      }
    }
    firmIcon = new ImageIcon("icons/firm.png");
  }