java 实现行程编码解码?

java 实现行程编码解码


茅侃侃
浏览 907回答 1
1回答

梵蒂冈之花

public class GuiCamera{private String fileName; //文件的前缀private String defaultName = "xxx";static int serialNum=0;private String imageFormat; //图像文件的格式private String defaultImageFormat="jpg";Dimension d = Toolkit.getDefaultToolkit().getScreenSize();public GuiCamera(String s,String format) {fileName = s;imageFormat=format;}public void snapShot() {try {//拷贝屏幕到一个BufferedImage对象screenshotBufferedImage screenshot = (new Robot()).createScreenCapture(newRectangle(0, 0, (int) d.getWidth(), (int) d.getHeight()));serialNum++;//根据文件前缀变量和文件格式变量,自动生成文件名String name=fileName+String.valueOf(serialNum)+"."+imageFormat;File f = new File(name);//将screenshot对象写入图像文件ImageIO.write(screenshot, imageFormat, f);}catch (Exception ex) {}}public static void main(String[] args){GuiCamera cam= new GuiCamera("d:\\java", "jpg");cam.snapShot();}}只能截取屏幕...传送可以以流的形式输出到对方。。。
打开App,查看更多内容
随时随地看视频慕课网APP