Skip to content

๐Ÿ A collection of partial JNA bindings for various macOS frameworks. (e.g. Foundation, AppKit, etc.)

License

Notifications You must be signed in to change notification settings

caoimhebyrne/JNApple

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

29 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

JNApple

๐Ÿ A collection of partial JNA bindings for various macOS frameworks. (e.g. Foundation, AppKit, etc.)

Usage

These are just some common examples, for a wider range, check out our tests.

Creating an NSString

var str = new NSString("Hello, World!");
// You can access this as a Java String if you wish too! (NSString#getJvmString)

Creating an NSURL

var str = new NSURL("https://cbyrne.dev");
// You can access this as a Java URL if you wish too! (NSURL#getJvmURL)

Copying text to the clipboard

var pasteboard = NSPasteboard.generalPasteboard();
pasteboard.clearContents();
pasteboard.setString("Hello, World!", NSPasteboard.TypeString);

Opening a file picker (NSOpenPanel)

var panel = NSOpenPanel.openPanel();
panel.setCanChooseFiles(true);

var result = panel.runModal();
if(result == NSAlert.NSModalResponse.OK) {
    NSURL url = panel.getURLs().objectAtIndex(0); // Can also use firstObject()
    System.out.println("First URL: " + url);
}

About

๐Ÿ A collection of partial JNA bindings for various macOS frameworks. (e.g. Foundation, AppKit, etc.)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages