资源描述:
《java 截图工具》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、java½Øͼ¹¤¾ßimportjava.awt.AWTException;importjava.awt.BorderLayout;importjava.awt.Button;importjava.awt.Color;importjava.awt.Cursor;importjava.awt.Dimension;importjava.awt.FileDialog;importjava.awt.Frame;importjava.awt.Graphics;importjava.awt.Image;importjava.a
2、wt.Panel;importjava.awt.Point;importjava.awt.Rectangle;importjava.awt.Robot;importjava.awt.Toolkit;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjava.awt.event.MouseEvent;importjava.awt.event.MouseListener;importjava.awt.event.MouseM
3、otionListener;importjava.awt.image.BufferedImage;importjava.io.File;importjava.io.IOException;importjavax.imageio.ImageIO;publicclassAWTpictureextendsFrameimplementsMouseListener,MouseMotionListener,ActionListener{privateintfirstX,firstY,frameWidth,frameHeight;p
4、rivateintfirstWith,firstHeight,firstPointx,firstPointy;privateBufferedImagebi,sbi,original;privateRobotrobot;privateRectanglerectangle;privateRectanglerectangleCursor,rectangleCursorUp,rectangleCursorDown,rectangleCursorLeft,rectangleCursorRight;privateRectangle
5、rectangleCursorRU,rectangleCursorRD,rectangleCursorLU,rectangleCursorLD;privateImagebis;privateDimensiondimension;privateButtonbutton,button2,clearButton;privatePoint[]point=newPoint[3];privateintwidth,height;privateintnPoints=5;privatePanelpanel;privatebooleand
6、rawHasFinish=false,change=false;privateintchangeFirstPointX,changeFirstPointY,changeWidth,changeHeight;privatebooleanchangeUP=false,changeDOWN=false,changeLEFT=false,changeRIGHT=false,changeRU=false,changeRD=false,changeLU=false,changeLD=false;privatebooleanclea
7、rPicture=false,redraw=false;privateFileDialogfileDialog;privateAWTpicture(){//È¡µÃÆÁÄ»´óСdimension=Toolkit.getDefaultToolkit().getScreenSize();frameWidth=dimension.width;frameHeight=dimension.height;fileDialog=newFileDialog(this,"½Øͼ",FileDialog.SAVE);rectangl
8、e=newRectangle(frameWidth,frameHeight);panel=newPanel();button=newButton("Í˳ö");button.setCursor(newCursor(Cursor.DEFAULT_CURSOR));button.setBackground(Color.green);