I tried to convert the first Java example from here:
http://home.cogeco.ca/~ve3ll/jatutorg.htm
This is my code:
Code:
namespace platformation;
interface
uses
java.awt,
javax.swing;
type
GFrame = public class(JFrame)
public
constructor();
class method main(arg: array of String);
end;
GCanvas = public class(Canvas)
public
method paint(g: Graphics); override;
end;
implementation
constructor GFrame();
begin
inherited ('Graphics Demo');
setBounds(50, 50, 300, 300);
// set frame
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
var con: Container := self.getContentPane();
// inherit main frame
con.setBackground(Color.white);
// paint background
var canvas: GCanvas := new GCanvas();
// create drawing canvas
con.&add(canvas);
setVisible(true)
end;
class method GFrame.main(arg: array of String);
begin
new GFrame()
end;
method GCanvas.paint(g: Graphics);
begin
end;
end.
When I compile the project, it complains on this line:
Code:
inherited ('Graphics Demo');
Code:
Error 1 (E105) Cannot invoke non-delegate type "javax.swing.JFrame" C:\Shared\My Dropbox\Oxygene for java\projects\platformation\platformation\Program.pas 23 3 platformation
Any ideas how to fix this sort of error?
cheers,
Paul
Bookmarks