请教JAVA问题
importjava.applet.*;importjava.awt.*;importjava.awt.image.*;importjavax.swing.*;impor...
import java.applet.*;
import java.awt.*;
import java.awt.image.*;
import javax.swing.*;
import java.awt.event.*;
public class exampel7_6 extends Applet{
Image myPicture;
public void init(){
myPicture=getImage(getCodeBase(),"1.jpg");
Image offScreenImage=createImage(size().width,size().height);
Graphics offScreenGc=offScreenImage.getGraphics();
offScreenGc.drawImage(myPicture,0,0,this);
new BufferedDemo(myPicture);
}
public boolean imageUpdate(Image img,int infoFlg,int x,int y,int w,int h){
if(infoFlg==ALLBITS){
repaint();
return false;
} else return true;
}
}
class BufferedDemo extends JFrame{
public BufferedDemo(Image img){
this.getContentPane().add(new PicPanel(img));
setTitle("双缓冲技术演示");
setSize(300,300);
setVisible(true);
}
}
class PicPanel extends JPanel implements MouseListener,MouseMotionListener{
int x=0,y=0,dx=0,dy=0;
BufferedImage bimg1,bimg2;
boolean upState=true;
public PicPanel(Image img){
this.setBackground(Color.white);
this.addMouseListener(this);
this.addMouseMotionListener(this);
bimg1=new BufferedImage(img.getWidth(this),img.getHeight(this),BufferedImage.TYPE_INT_ARGB);
bimg2=new BufferedImage(img.getWidth(this),img.getHeight(this),BufferedImage.TYPE_INT_ARGB);
Graphics2D g2D1=bimg1.createGraphics();
Graphics2D g2D2=bimg2.createGraphics();
g2D1.drawImage(img,0,0,this);
g2D2.drawImage(img,0,0,this);
g2D2.drawRect(1,1,img.getWidth(this)-3,img.getHeight(this)-3);
}
TO BE CONTINUED IN THE APPENDED PAGE
篇幅有限,问题没有写出来,请不要回答 展开
import java.awt.*;
import java.awt.image.*;
import javax.swing.*;
import java.awt.event.*;
public class exampel7_6 extends Applet{
Image myPicture;
public void init(){
myPicture=getImage(getCodeBase(),"1.jpg");
Image offScreenImage=createImage(size().width,size().height);
Graphics offScreenGc=offScreenImage.getGraphics();
offScreenGc.drawImage(myPicture,0,0,this);
new BufferedDemo(myPicture);
}
public boolean imageUpdate(Image img,int infoFlg,int x,int y,int w,int h){
if(infoFlg==ALLBITS){
repaint();
return false;
} else return true;
}
}
class BufferedDemo extends JFrame{
public BufferedDemo(Image img){
this.getContentPane().add(new PicPanel(img));
setTitle("双缓冲技术演示");
setSize(300,300);
setVisible(true);
}
}
class PicPanel extends JPanel implements MouseListener,MouseMotionListener{
int x=0,y=0,dx=0,dy=0;
BufferedImage bimg1,bimg2;
boolean upState=true;
public PicPanel(Image img){
this.setBackground(Color.white);
this.addMouseListener(this);
this.addMouseMotionListener(this);
bimg1=new BufferedImage(img.getWidth(this),img.getHeight(this),BufferedImage.TYPE_INT_ARGB);
bimg2=new BufferedImage(img.getWidth(this),img.getHeight(this),BufferedImage.TYPE_INT_ARGB);
Graphics2D g2D1=bimg1.createGraphics();
Graphics2D g2D2=bimg2.createGraphics();
g2D1.drawImage(img,0,0,this);
g2D2.drawImage(img,0,0,this);
g2D2.drawRect(1,1,img.getWidth(this)-3,img.getHeight(this)-3);
}
TO BE CONTINUED IN THE APPENDED PAGE
篇幅有限,问题没有写出来,请不要回答 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励30(财富值+成长值)
1个回答
展开全部
我回答了你回复了上传代码上来吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询