国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

如何用 java 編寫一個掃描儀程序

2019-11-18 13:18:11
字體:
來源:轉載
供稿:網友

  javatwain may be a powerful solution,you can go to www.gnome.sk to download the newest package.
   JavaTwain version 5.1 is a part of the Morena 6.0 Framework now.
  
   below is an simple example:
   /*
   * $Id: ExampleShow.java,v 1.5 2002/07/15 13:48:55 mmotovsk EXP $
   *
   * Copyright (c) 1999-2002 Gnome spol. s r.o. All Rights Reserved.
   *
   * This software is the confidential and PRoprietary information of
   * Gnome spol. s r.o. You shall not disclose sUCh Confidential
   * Information and shall use it only in accordance with the terms
   * of the license agreement you entered into with Gnome.
   */
  
  // JavaTwain package version 5.1
  
  /**
   ExampleShow demonstrates how to scan an image using defaults
   from the Twain source. <BR>
  */
  
  import java.awt.*;
  import java.awt.event.*;
  import SK.gnome.twain.*;
  
  public class ExampleShow extends Frame
  { Image image;
   public void paint(Graphics g) 
   { if (null!=image)
     g.drawImage(image, 0, 0, this);
   }
   
   WindowListener windowAdapter=new WindowAdapter()
   { public void windowClosing(WindowEvent e)
    { System.exit(0);
    }
   };
   
   public ExampleShow()
   { try
    { addWindowListener(windowAdapter);
     setTitle("ExampleShow Frame application");
     // Open TWAIN select source dialog box
     // and initialize the source selected by the user.
     TwainSource source=TwainManager.selectSource(null);
     image=Toolkit.getDefaultToolkit().createImage(source);
     // wait for the image to be completed
     MediaTracker tracker=new MediaTracker(this);
     tracker.addImage(image, 0);
     // this is the moment the scanner user interface pops up
     System.err.println("Start loading image ...");
     try
     { tracker.waitForAll();
     }
     catch (InterruptedException e)
     { System.err.println("Image loading was interrupted!");
      e.printStackTrace();
     }
     tracker.removeImage(image);
     System.err.println("Image loaded ...");
     setSize(image.getWidth(this), image.getHeight(this));
     setVisible(true);
     TwainManager.close();
    }
    catch (TwainException e)
    { e.printStackTrace();
    }
   }
   
   public static void main(String[] args)
   { new ExampleShow();
   }
  }

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 芮城县| 子洲县| 竹北市| 郸城县| 镶黄旗| 济宁市| 柏乡县| 同仁县| 兖州市| 白朗县| 土默特左旗| 广昌县| 大英县| 凉山| 吴桥县| 托里县| 庆城县| 三都| 始兴县| 桂平市| 萍乡市| 吉林市| 桓仁| 汉中市| 南靖县| 丹凤县| 龙游县| 遂宁市| 香格里拉县| 保靖县| 堆龙德庆县| 通河县| 岳阳市| 新乡市| 信阳市| 弋阳县| 留坝县| 富川| 海宁市| 晴隆县| 鄂托克旗|