www.pudn.com > img_process_java.zip > Main.java
import java.awt.*;
class Main extends Frame
{
int mouse;
int pass;
int[] a = new int[1];
//a[0] = 0;
// The contructor creates a frame with a window size that gives
// the desired interior size.
Main() {
super("Frame Example");
// Calling addNotify() creates the peers; otherwise insets()
// does not return the right values.
addNotify();
Insets insets = insets();
resize(insets.left + insets.right + 150,
insets.top + insets.bottom + 150);
}
public boolean mouseDown(Event evt, int x, int y) {
// x, y are in interior coordinates and must be translated
// first to window coordinates and then to screen coordinates.
Insets insets = insets();
Rectangle bounds = bounds();
//Main m = new Main();
x += insets.left + bounds.x;
y += insets.top + bounds.y;
mouse = x+y;
System.out.println("Mouse has move to (" + x + ", " + y + "); mouse = " + mouse);
//System.out.println("Global parameter pass: " + pass);
//testParameter(&pass);
add2(a);
//m.move(x, y);
//m.show();
return true;
}
/*public void testParameter(int pass)
{
System.out.println("Parameter pass before change: " + pass);
pass = &mouse;
System.out.println("Parameter pass after change: " + pass);
}*/
void add2(int[] a)
{
//a = new int[1];
System.out.println("Parameter a[0] before change: " + a[0]);
a[0] = a[0] + mouse;
System.out.println("Parameter a[0] after change: " + a[0]);
}
static public void main(String[] args)
{
(new Main()).show();
}
}