Are you overriding super's getLocation method? If not you just call it.
abstract class ABaseClass {
public aMethod() { System.out.println("ABaseClass.aMethod"); }
public bMethod() { System.out.println("ABaseClass.bMethod"); }
}
class ARealClass extends ABaseClass {
public aMethod() { System.out.println("ARealClass.bMethod"); }
public static void main(String[] args) {
ARealClass c = new ARealClass();
c.aMethod();
c.bMethod();
}
}
Try and guess what gets printed before you run it.
Keith.
here is some pseudo code
public class App extends JFrame {
public App() {
ActionListener...{
getLocation() //this should be called to find the window location, it is a JFrame method
}
}
Here's the code.
public class App extends javax.swing.JFrame {
Rectangle _captureArea;
public App() {
initComponents();
captureButton.addActionListener(new ActionListener( ) {
public void actionPerformed(ActionEvent ev) {
_captureArea = new Rectangle(App.this.getLocationOnScreen().getX()-320, App.this.getLocationOnScreen().getY(), 320, 45);
}
});
} //end of constructor
//...
}
Here is the error:
init:
deps-jar:
Compiling 1 source file to C:\Documents and Settings\James Kovacs\TextTwistPlayer\build\classes
C:\Documents and Settings\James Kovacs\TextTwistPlayer\src\App.java:39: cannot find symbol
symbol : constructor Rectangle(double,double,int,int)
location: class java.awt.Rectangle
_captureArea = new Rectangle(App.this.getLocationOnScreen().getX()-320, App.this.getLocationOnScreen().getY(), 320, 45);
1 error
BUILD FAILED (total time: 1 second)
Message was edited by:
jdk2006
Rectangle has no constructor with (double, double, int, int) arguments, only (int, int, int, int).
getX() anf getY() are returning double, use .x and .y to get int
(or cast the result from getX() and getY() to int).
_captureArea = new Rectangle(App.this.getLocationOnScreen().x-320, App.this.getLocationOnScreen().y, 320, 45);