1. Getting started
2. Calling methods
3. Working with .NET Objects
4. Fields and Properties
5. Methods Arguments
6. Nested Types
7. Enums
8. Arrays and Collections
9. Embeding UI controls
10. Referencing libraries
11. Off-line activation
12. Events and Delegates
13. Disposing and Garabage Collection
14. .NET Configuration Files (AppConfig, WebConfig)
15. Exceptions, Debugging and Testing
16. Strongly-Typed Wrappers
    17. Advanced Activation and Licensing
    18 Other usage scenarios

      Passing Reference-Type Arguments

      With Javonet, you can very easily pass any .NET object as argument to any .NET method, or substitute a .NET field or property. Instances of .NET objects can be stored in your Java application using the special NObject type variable. When passing the NObject object to the .NET method, Javonet just pass it as a reference.

        NObject size = Javonet.New("System.Drawing.Size");
        size.set("Width", 500);
        size.set("Height", 100);
        NObject label = Javonet.New("System.Windows.Forms.Label")
        label.set("Size", size);

      As you see you can create an instance of the Size object, set its “Width” and “Height” properties, and pass it into the Size property on the Label object. This way you can pass the object as an argument to any method or field and property.


        NObject nowDateObj= Javonet.getType("DateTime").get("Now");
        NObject date = Javonet.New("DateTime",1980,1,1);
        NObject datesDiff = nowDateObj.invoke("Subtract",date);

      Here the “Now” field gets a value from DateTime. Then we create a new DateTime value, passing a date of 1980-01-01 as constructor arguments, then we subtract these dates. The datesDiff variable will store an instance of the TimeSpan object that holds the difference between now and 1980-01-01.

      See Live Example!