aspose file tools*
The moose likes Applets and the fly likes why it could not work properly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "why it could not work properly" Watch "why it could not work properly" New topic
Author

why it could not work properly

Porky Liu
Greenhorn

Joined: Jan 30, 2002
Posts: 22
Below is part of my program,and it is expected to view the special subimage with mouse dragging.
public boolean mouseDrag(MouseEvent e,int x,int y) {
//to veirfy that the mouse is on the image;
if(x>0 && y>height+20 && x<img.getWidth(this) && y<img.getHeight(this)+height+20)
{
if(ini)
ini=false;
centerX=x;
centerY=y-height-20;
if(centerX<width/2)
centerX=width/2;
if(centerX>(size().width-width/2))
centerX=size().width-width/2;
if(centerY<height/2)
centerY=height/2;
if(centerY<(size().height-height/2))
centerY=size().height-height/2;
//show the rectangle subimage centered by (centerX,centerY)
temp=this.createImage(new FilteredImageSource(img.getSource(), new CropImageFilter(centerX-width/2, centerY-height/2, width, height)));
screen=temp;
this.update(this.getGraphics());
}
return true;
}
public void paint(Graphics g) {
g.drawImage(img,0,height+20,this);
g.drawImage(screen,0,0,this);
g.setColor(Color.red);
g.drawRect(0,20+height,img.getWidth(this),size().height-20-height);
g.setColor(Color.black);
g.drawRect(0,0,width,height);
}
For help!
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
HI Porky,
Can't help with your problem, but your user name is not a valid one here at the ranch. We request that you supply a first name + space + last name. Please read the naming convention policy and re-register with an appropriate name.
Regards,
Manfred.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why it could not work properly