📄 rectangle.java
字号:
// Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov Date: 2005-4-9 12:51:46
// Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: Rectangle.java
package girl60;
public class Rectangle
{
public Rectangle()
{
this(0, 0, 0, 0);
}
public Rectangle(int x, int y, int width, int height)
{
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
public Rectangle(int width, int height)
{
this(0, 0, width, height);
}
public Rectangle(Rectangle r)
{
this(r.x, r.y, r.width, r.height);
}
public int GetX()
{
return x;
}
public int GetY()
{
return y;
}
public void SetX(int x)
{
this.x = x;
}
public void SetY(int y)
{
this.y = y;
}
public void SetLocation(int x, int y)
{
this.x = x;
this.y = y;
}
public void MoveX(int offset)
{
x += offset;
}
public void MoveY(int offset)
{
y += offset;
}
public int GetWidth()
{
return width;
}
public int GetHeight()
{
return height;
}
public void SetWidth(int width)
{
this.width = width;
}
public void SetHeight(int height)
{
this.height = height;
}
public void SetSize(int width, int height)
{
this.width = width;
this.height = height;
}
public void SetBounds(int x, int y, int width, int height)
{
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
public boolean Contains(Rectangle r)
{
return Contains(r.x, r.y, r.width, r.height);
}
public boolean Contains(int X, int Y, int W, int H)
{
int w = width;
int h = height;
if((w | h | W | H) < 0)
return false;
int x = this.x;
int y = this.y;
if(X < x || Y < y)
return false;
w += x;
W += X;
if(W <= X)
{
if(w >= x || W > w)
return false;
} else
if(w >= x && W > w)
return false;
h += y;
H += Y;
if(H <= Y)
{
if(h >= y || H > h)
return false;
} else
if(h >= y && H > h)
return false;
return true;
}
public boolean Inside(int X, int Y)
{
int w = width;
int h = height;
if((w | h) < 0)
return false;
int x = this.x;
int y = this.y;
if(X < x || Y < y)
{
return false;
} else
{
w += x;
h += y;
return (w < x || w > X) && (h < y || h > Y);
}
}
public boolean Intersects(Rectangle r)
{
int tw = width;
int th = height;
int rw = r.width;
int rh = r.height;
if(rw <= 0 || rh <= 0 || tw <= 0 || th <= 0)
{
return false;
} else
{
int tx = x;
int ty = y;
int rx = r.x;
int ry = r.y;
rw += rx;
rh += ry;
tw += tx;
th += ty;
return (rw < rx || rw > tx) && (rh < ry || rh > ty) && (tw < tx || tw > rx) && (th < ty || th > ry);
}
}
public int x;
public int y;
public int width;
public int height;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -