Results 1 to 3 of 3

Thread: Trouble converting Java examples to Oxygene using inherited in classes

  1. #1

    Trouble converting Java examples to Oxygene using inherited in classes

    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
    Last edited by paul_nicholls; 14-04-2012 at 12:12 PM.

  2. #2
    Code:
    inherited constructor ('Graphics Demo');
    Imagine I've written something clever here inspiring you to make something awesome. If that happens give me credits

  3. #3

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •