drawpane.java~1~
来自「这是各类实用工具的源码100例」· JAVA~1~ 代码 · 共 32 行
JAVA~1~
32 行
package jimagemovedemo;import javax.swing.JPanel;import java.awt.event.MouseEvent;import java.awt.event.MouseMotionListener;import java.awt.*;import java.awt.image.*;class DrawPane extends JPanel implements MouseMotionListener { private int x,y; BufferedImage bimage; public DrawPane(){ this.setBackground(Color.white); this.addMouseMotionListener(this); } Image image = this.getToolkit().getImage(ClassLoader.getSystemResource("images/image.jpg")); MediaTracker mt = new MediaTracker(this); mt.addImage(image,1); public void mouseDragged(MouseEvent e) { /**@todo Implement this java.awt.event.MouseMotionListener method*/ //throw new java.lang.UnsupportedOperationException("Method mouseDragged() not yet implemented."); } public void mouseMoved(MouseEvent e) { /**@todo Implement this java.awt.event.MouseMotionListener method*/ //throw new java.lang.UnsupportedOperationException("Method mouseMoved() not yet implemented."); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?