Пример #1
0
  public void init() {
    try {
      this.imLogo = this.getImage("icon.png");
      tracker.addImage(this.imLogo, 0);
      tracker.waitForID(0);
    } catch (InterruptedException inex) {

    }
    try {
      this.imHelp = this.getImage("helpphoto.png");
      tracker.addImage(this.imHelp, 1);
      tracker.waitForID(1);
    } catch (InterruptedException ie) {
    }
    this.fontTitle = new Font("GB2312", Font.BOLD, 25);
    this.fontText = new Font("GB2312", Font.PLAIN, 18);
    this.setBackground(Color.BLACK);
    this.setForeground(Color.WHITE);
    this.timer =
        new Timer(
            500,
            new ActionListener() {
              public void actionPerformed(ActionEvent ev) {
                world = new OSCWorld();
                world.onEnter();
                repaint();
                timer.stop();
              }
            });
    this.timer.start();
  }
Пример #2
0
  public static java.awt.image.BufferedImage loadBufferedImageFromResources(
      Component c, String filename) {

    try {
      Misc m = new Misc();
      java.awt.Image img = loadImageFromResources(filename);
      MediaTracker mt = new MediaTracker(c);
      mt.addImage(img, 0);
      mt.waitForID(0);
      int width = img.getWidth(null);
      int height = img.getHeight(null);
      BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
      Graphics gg = bi.getGraphics();
      gg.drawImage(img, 0, 0, null);
      gg.dispose();
      return bi;
    } catch (Exception ex) {
      System.out.println(ex.toString());
    }
    return null;
  }