com.apple.jobjc.foundation.FoundationFramework Java Examples
The following examples show how to use
com.apple.jobjc.foundation.FoundationFramework.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PooledTestCase.java From hottub with GNU General Public License v2.0 | 4 votes |
@Override public void setUp() throws Exception { FoundationFramework foundation = JObjC.getInstance().Foundation(); pool = foundation.NSAutoreleasePool().alloc(); pool.init(); }
Example #2
Source File: IntroTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
public void testFrameworks(){ // First, get an instance of JObjC: final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance(); // It's your gateway to the frameworks. final FoundationFramework FND = JOBJC.Foundation(); final AppKitFramework APP = JOBJC.AppKit(); // From which you can then access... // enums, defines, constants int nsmye = FND.NSMaxYEdge(); boolean debug = FND.NSDebugEnabled(); // structs NSPoint p = FND.makeNSPoint(); p.setX(3); assertEquals(3.0, p.x()); // C functions NSPoint p2 = FND.NSMakePoint(12, 34); assertEquals(12.0, p2.x()); // ... Let's create an AutoreleasePool before we go on NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init(); // Objective-C classes NSStringClass nsc = FND.NSString(); // class-methods NSString nsStringClassDescr = nsc.description(); // instances NSString nsi = ((NSString) FND.NSString().alloc()).init(); // instance methods NSString d = nsi.description(); // The bridge marshals some types for you, but it doesn't // convert between NSString and Java String automatically. // For that we use Utils.get().strings().nsString(String) // and Utils.get().strings().javaString(NSString); assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr)); NSString format = Utils.get().strings().nsString("Foo bar %d baz"); NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34); String jformatted = Utils.get().strings().javaString(formatted); assertEquals("Foo bar 34 baz", jformatted); // Reveal in Finder // NSString file = Utils.get().strings().nsString( // "/Applications/Calculator.app/Contents/Resources/Calculator.icns"); // APP.NSWorkspace().sharedWorkspace() // .selectFile_inFileViewerRootedAtPath(file, null); pool.drain(); }
Example #3
Source File: PooledTestCase.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
@Override public void setUp() throws Exception { FoundationFramework foundation = JObjC.getInstance().Foundation(); pool = foundation.NSAutoreleasePool().alloc(); pool.init(); }
Example #4
Source File: IntroTest.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void testFrameworks(){ // First, get an instance of JObjC: final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance(); // It's your gateway to the frameworks. final FoundationFramework FND = JOBJC.Foundation(); final AppKitFramework APP = JOBJC.AppKit(); // From which you can then access... // enums, defines, constants int nsmye = FND.NSMaxYEdge(); boolean debug = FND.NSDebugEnabled(); // structs NSPoint p = FND.makeNSPoint(); p.setX(3); assertEquals(3.0, p.x()); // C functions NSPoint p2 = FND.NSMakePoint(12, 34); assertEquals(12.0, p2.x()); // ... Let's create an AutoreleasePool before we go on NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init(); // Objective-C classes NSStringClass nsc = FND.NSString(); // class-methods NSString nsStringClassDescr = nsc.description(); // instances NSString nsi = ((NSString) FND.NSString().alloc()).init(); // instance methods NSString d = nsi.description(); // The bridge marshals some types for you, but it doesn't // convert between NSString and Java String automatically. // For that we use Utils.get().strings().nsString(String) // and Utils.get().strings().javaString(NSString); assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr)); NSString format = Utils.get().strings().nsString("Foo bar %d baz"); NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34); String jformatted = Utils.get().strings().javaString(formatted); assertEquals("Foo bar 34 baz", jformatted); // Reveal in Finder // NSString file = Utils.get().strings().nsString( // "/Applications/Calculator.app/Contents/Resources/Calculator.icns"); // APP.NSWorkspace().sharedWorkspace() // .selectFile_inFileViewerRootedAtPath(file, null); pool.drain(); }
Example #5
Source File: PooledTestCase.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
@Override public void setUp() throws Exception { FoundationFramework foundation = JObjC.getInstance().Foundation(); pool = foundation.NSAutoreleasePool().alloc(); pool.init(); }
Example #6
Source File: IntroTest.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
public void testFrameworks(){ // First, get an instance of JObjC: final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance(); // It's your gateway to the frameworks. final FoundationFramework FND = JOBJC.Foundation(); final AppKitFramework APP = JOBJC.AppKit(); // From which you can then access... // enums, defines, constants int nsmye = FND.NSMaxYEdge(); boolean debug = FND.NSDebugEnabled(); // structs NSPoint p = FND.makeNSPoint(); p.setX(3); assertEquals(3.0, p.x()); // C functions NSPoint p2 = FND.NSMakePoint(12, 34); assertEquals(12.0, p2.x()); // ... Let's create an AutoreleasePool before we go on NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init(); // Objective-C classes NSStringClass nsc = FND.NSString(); // class-methods NSString nsStringClassDescr = nsc.description(); // instances NSString nsi = ((NSString) FND.NSString().alloc()).init(); // instance methods NSString d = nsi.description(); // The bridge marshals some types for you, but it doesn't // convert between NSString and Java String automatically. // For that we use Utils.get().strings().nsString(String) // and Utils.get().strings().javaString(NSString); assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr)); NSString format = Utils.get().strings().nsString("Foo bar %d baz"); NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34); String jformatted = Utils.get().strings().javaString(formatted); assertEquals("Foo bar 34 baz", jformatted); // Reveal in Finder // NSString file = Utils.get().strings().nsString( // "/Applications/Calculator.app/Contents/Resources/Calculator.icns"); // APP.NSWorkspace().sharedWorkspace() // .selectFile_inFileViewerRootedAtPath(file, null); pool.drain(); }
Example #7
Source File: PooledTestCase.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
@Override public void setUp() throws Exception { FoundationFramework foundation = JObjC.getInstance().Foundation(); pool = foundation.NSAutoreleasePool().alloc(); pool.init(); }
Example #8
Source File: IntroTest.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public void testFrameworks(){ // First, get an instance of JObjC: final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance(); // It's your gateway to the frameworks. final FoundationFramework FND = JOBJC.Foundation(); final AppKitFramework APP = JOBJC.AppKit(); // From which you can then access... // enums, defines, constants int nsmye = FND.NSMaxYEdge(); boolean debug = FND.NSDebugEnabled(); // structs NSPoint p = FND.makeNSPoint(); p.setX(3); assertEquals(3.0, p.x()); // C functions NSPoint p2 = FND.NSMakePoint(12, 34); assertEquals(12.0, p2.x()); // ... Let's create an AutoreleasePool before we go on NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init(); // Objective-C classes NSStringClass nsc = FND.NSString(); // class-methods NSString nsStringClassDescr = nsc.description(); // instances NSString nsi = ((NSString) FND.NSString().alloc()).init(); // instance methods NSString d = nsi.description(); // The bridge marshals some types for you, but it doesn't // convert between NSString and Java String automatically. // For that we use Utils.get().strings().nsString(String) // and Utils.get().strings().javaString(NSString); assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr)); NSString format = Utils.get().strings().nsString("Foo bar %d baz"); NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34); String jformatted = Utils.get().strings().javaString(formatted); assertEquals("Foo bar 34 baz", jformatted); // Reveal in Finder // NSString file = Utils.get().strings().nsString( // "/Applications/Calculator.app/Contents/Resources/Calculator.icns"); // APP.NSWorkspace().sharedWorkspace() // .selectFile_inFileViewerRootedAtPath(file, null); pool.drain(); }
Example #9
Source File: PooledTestCase.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
@Override public void setUp() throws Exception { FoundationFramework foundation = JObjC.getInstance().Foundation(); pool = foundation.NSAutoreleasePool().alloc(); pool.init(); }
Example #10
Source File: IntroTest.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public void testFrameworks(){ // First, get an instance of JObjC: final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance(); // It's your gateway to the frameworks. final FoundationFramework FND = JOBJC.Foundation(); final AppKitFramework APP = JOBJC.AppKit(); // From which you can then access... // enums, defines, constants int nsmye = FND.NSMaxYEdge(); boolean debug = FND.NSDebugEnabled(); // structs NSPoint p = FND.makeNSPoint(); p.setX(3); assertEquals(3.0, p.x()); // C functions NSPoint p2 = FND.NSMakePoint(12, 34); assertEquals(12.0, p2.x()); // ... Let's create an AutoreleasePool before we go on NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init(); // Objective-C classes NSStringClass nsc = FND.NSString(); // class-methods NSString nsStringClassDescr = nsc.description(); // instances NSString nsi = ((NSString) FND.NSString().alloc()).init(); // instance methods NSString d = nsi.description(); // The bridge marshals some types for you, but it doesn't // convert between NSString and Java String automatically. // For that we use Utils.get().strings().nsString(String) // and Utils.get().strings().javaString(NSString); assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr)); NSString format = Utils.get().strings().nsString("Foo bar %d baz"); NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34); String jformatted = Utils.get().strings().javaString(formatted); assertEquals("Foo bar 34 baz", jformatted); // Reveal in Finder // NSString file = Utils.get().strings().nsString( // "/Applications/Calculator.app/Contents/Resources/Calculator.icns"); // APP.NSWorkspace().sharedWorkspace() // .selectFile_inFileViewerRootedAtPath(file, null); pool.drain(); }
Example #11
Source File: PooledTestCase.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
@Override public void setUp() throws Exception { FoundationFramework foundation = JObjC.getInstance().Foundation(); pool = foundation.NSAutoreleasePool().alloc(); pool.init(); }
Example #12
Source File: IntroTest.java From hottub with GNU General Public License v2.0 | 4 votes |
public void testFrameworks(){ // First, get an instance of JObjC: final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance(); // It's your gateway to the frameworks. final FoundationFramework FND = JOBJC.Foundation(); final AppKitFramework APP = JOBJC.AppKit(); // From which you can then access... // enums, defines, constants int nsmye = FND.NSMaxYEdge(); boolean debug = FND.NSDebugEnabled(); // structs NSPoint p = FND.makeNSPoint(); p.setX(3); assertEquals(3.0, p.x()); // C functions NSPoint p2 = FND.NSMakePoint(12, 34); assertEquals(12.0, p2.x()); // ... Let's create an AutoreleasePool before we go on NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init(); // Objective-C classes NSStringClass nsc = FND.NSString(); // class-methods NSString nsStringClassDescr = nsc.description(); // instances NSString nsi = ((NSString) FND.NSString().alloc()).init(); // instance methods NSString d = nsi.description(); // The bridge marshals some types for you, but it doesn't // convert between NSString and Java String automatically. // For that we use Utils.get().strings().nsString(String) // and Utils.get().strings().javaString(NSString); assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr)); NSString format = Utils.get().strings().nsString("Foo bar %d baz"); NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34); String jformatted = Utils.get().strings().javaString(formatted); assertEquals("Foo bar 34 baz", jformatted); // Reveal in Finder // NSString file = Utils.get().strings().nsString( // "/Applications/Calculator.app/Contents/Resources/Calculator.icns"); // APP.NSWorkspace().sharedWorkspace() // .selectFile_inFileViewerRootedAtPath(file, null); pool.drain(); }
Example #13
Source File: PooledTestCase.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
@Override public void setUp() throws Exception { FoundationFramework foundation = JObjC.getInstance().Foundation(); pool = foundation.NSAutoreleasePool().alloc(); pool.init(); }
Example #14
Source File: IntroTest.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void testFrameworks(){ // First, get an instance of JObjC: final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance(); // It's your gateway to the frameworks. final FoundationFramework FND = JOBJC.Foundation(); final AppKitFramework APP = JOBJC.AppKit(); // From which you can then access... // enums, defines, constants int nsmye = FND.NSMaxYEdge(); boolean debug = FND.NSDebugEnabled(); // structs NSPoint p = FND.makeNSPoint(); p.setX(3); assertEquals(3.0, p.x()); // C functions NSPoint p2 = FND.NSMakePoint(12, 34); assertEquals(12.0, p2.x()); // ... Let's create an AutoreleasePool before we go on NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init(); // Objective-C classes NSStringClass nsc = FND.NSString(); // class-methods NSString nsStringClassDescr = nsc.description(); // instances NSString nsi = ((NSString) FND.NSString().alloc()).init(); // instance methods NSString d = nsi.description(); // The bridge marshals some types for you, but it doesn't // convert between NSString and Java String automatically. // For that we use Utils.get().strings().nsString(String) // and Utils.get().strings().javaString(NSString); assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr)); NSString format = Utils.get().strings().nsString("Foo bar %d baz"); NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34); String jformatted = Utils.get().strings().javaString(formatted); assertEquals("Foo bar 34 baz", jformatted); // Reveal in Finder // NSString file = Utils.get().strings().nsString( // "/Applications/Calculator.app/Contents/Resources/Calculator.icns"); // APP.NSWorkspace().sharedWorkspace() // .selectFile_inFileViewerRootedAtPath(file, null); pool.drain(); }
Example #15
Source File: PooledTestCase.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
@Override public void setUp() throws Exception { FoundationFramework foundation = JObjC.getInstance().Foundation(); pool = foundation.NSAutoreleasePool().alloc(); pool.init(); }
Example #16
Source File: IntroTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public void testFrameworks(){ // First, get an instance of JObjC: final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance(); // It's your gateway to the frameworks. final FoundationFramework FND = JOBJC.Foundation(); final AppKitFramework APP = JOBJC.AppKit(); // From which you can then access... // enums, defines, constants int nsmye = FND.NSMaxYEdge(); boolean debug = FND.NSDebugEnabled(); // structs NSPoint p = FND.makeNSPoint(); p.setX(3); assertEquals(3.0, p.x()); // C functions NSPoint p2 = FND.NSMakePoint(12, 34); assertEquals(12.0, p2.x()); // ... Let's create an AutoreleasePool before we go on NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init(); // Objective-C classes NSStringClass nsc = FND.NSString(); // class-methods NSString nsStringClassDescr = nsc.description(); // instances NSString nsi = ((NSString) FND.NSString().alloc()).init(); // instance methods NSString d = nsi.description(); // The bridge marshals some types for you, but it doesn't // convert between NSString and Java String automatically. // For that we use Utils.get().strings().nsString(String) // and Utils.get().strings().javaString(NSString); assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr)); NSString format = Utils.get().strings().nsString("Foo bar %d baz"); NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34); String jformatted = Utils.get().strings().javaString(formatted); assertEquals("Foo bar 34 baz", jformatted); // Reveal in Finder // NSString file = Utils.get().strings().nsString( // "/Applications/Calculator.app/Contents/Resources/Calculator.icns"); // APP.NSWorkspace().sharedWorkspace() // .selectFile_inFileViewerRootedAtPath(file, null); pool.drain(); }
Example #17
Source File: PooledTestCase.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Override public void setUp() throws Exception { FoundationFramework foundation = JObjC.getInstance().Foundation(); pool = foundation.NSAutoreleasePool().alloc(); pool.init(); }
Example #18
Source File: IntroTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public void testFrameworks(){ // First, get an instance of JObjC: final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance(); // It's your gateway to the frameworks. final FoundationFramework FND = JOBJC.Foundation(); final AppKitFramework APP = JOBJC.AppKit(); // From which you can then access... // enums, defines, constants int nsmye = FND.NSMaxYEdge(); boolean debug = FND.NSDebugEnabled(); // structs NSPoint p = FND.makeNSPoint(); p.setX(3); assertEquals(3.0, p.x()); // C functions NSPoint p2 = FND.NSMakePoint(12, 34); assertEquals(12.0, p2.x()); // ... Let's create an AutoreleasePool before we go on NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init(); // Objective-C classes NSStringClass nsc = FND.NSString(); // class-methods NSString nsStringClassDescr = nsc.description(); // instances NSString nsi = ((NSString) FND.NSString().alloc()).init(); // instance methods NSString d = nsi.description(); // The bridge marshals some types for you, but it doesn't // convert between NSString and Java String automatically. // For that we use Utils.get().strings().nsString(String) // and Utils.get().strings().javaString(NSString); assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr)); NSString format = Utils.get().strings().nsString("Foo bar %d baz"); NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34); String jformatted = Utils.get().strings().javaString(formatted); assertEquals("Foo bar 34 baz", jformatted); // Reveal in Finder // NSString file = Utils.get().strings().nsString( // "/Applications/Calculator.app/Contents/Resources/Calculator.icns"); // APP.NSWorkspace().sharedWorkspace() // .selectFile_inFileViewerRootedAtPath(file, null); pool.drain(); }
Example #19
Source File: PooledTestCase.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Override public void setUp() throws Exception { FoundationFramework foundation = JObjC.getInstance().Foundation(); pool = foundation.NSAutoreleasePool().alloc(); pool.init(); }
Example #20
Source File: IntroTest.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public void testFrameworks(){ // First, get an instance of JObjC: final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance(); // It's your gateway to the frameworks. final FoundationFramework FND = JOBJC.Foundation(); final AppKitFramework APP = JOBJC.AppKit(); // From which you can then access... // enums, defines, constants int nsmye = FND.NSMaxYEdge(); boolean debug = FND.NSDebugEnabled(); // structs NSPoint p = FND.makeNSPoint(); p.setX(3); assertEquals(3.0, p.x()); // C functions NSPoint p2 = FND.NSMakePoint(12, 34); assertEquals(12.0, p2.x()); // ... Let's create an AutoreleasePool before we go on NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init(); // Objective-C classes NSStringClass nsc = FND.NSString(); // class-methods NSString nsStringClassDescr = nsc.description(); // instances NSString nsi = ((NSString) FND.NSString().alloc()).init(); // instance methods NSString d = nsi.description(); // The bridge marshals some types for you, but it doesn't // convert between NSString and Java String automatically. // For that we use Utils.get().strings().nsString(String) // and Utils.get().strings().javaString(NSString); assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr)); NSString format = Utils.get().strings().nsString("Foo bar %d baz"); NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34); String jformatted = Utils.get().strings().javaString(formatted); assertEquals("Foo bar 34 baz", jformatted); // Reveal in Finder // NSString file = Utils.get().strings().nsString( // "/Applications/Calculator.app/Contents/Resources/Calculator.icns"); // APP.NSWorkspace().sharedWorkspace() // .selectFile_inFileViewerRootedAtPath(file, null); pool.drain(); }
Example #21
Source File: PooledTestCase.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Override public void setUp() throws Exception { FoundationFramework foundation = JObjC.getInstance().Foundation(); pool = foundation.NSAutoreleasePool().alloc(); pool.init(); }
Example #22
Source File: IntroTest.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public void testFrameworks(){ // First, get an instance of JObjC: final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance(); // It's your gateway to the frameworks. final FoundationFramework FND = JOBJC.Foundation(); final AppKitFramework APP = JOBJC.AppKit(); // From which you can then access... // enums, defines, constants int nsmye = FND.NSMaxYEdge(); boolean debug = FND.NSDebugEnabled(); // structs NSPoint p = FND.makeNSPoint(); p.setX(3); assertEquals(3.0, p.x()); // C functions NSPoint p2 = FND.NSMakePoint(12, 34); assertEquals(12.0, p2.x()); // ... Let's create an AutoreleasePool before we go on NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init(); // Objective-C classes NSStringClass nsc = FND.NSString(); // class-methods NSString nsStringClassDescr = nsc.description(); // instances NSString nsi = ((NSString) FND.NSString().alloc()).init(); // instance methods NSString d = nsi.description(); // The bridge marshals some types for you, but it doesn't // convert between NSString and Java String automatically. // For that we use Utils.get().strings().nsString(String) // and Utils.get().strings().javaString(NSString); assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr)); NSString format = Utils.get().strings().nsString("Foo bar %d baz"); NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34); String jformatted = Utils.get().strings().javaString(formatted); assertEquals("Foo bar 34 baz", jformatted); // Reveal in Finder // NSString file = Utils.get().strings().nsString( // "/Applications/Calculator.app/Contents/Resources/Calculator.icns"); // APP.NSWorkspace().sharedWorkspace() // .selectFile_inFileViewerRootedAtPath(file, null); pool.drain(); }
Example #23
Source File: PooledTestCase.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@Override public void setUp() throws Exception { FoundationFramework foundation = JObjC.getInstance().Foundation(); pool = foundation.NSAutoreleasePool().alloc(); pool.init(); }
Example #24
Source File: IntroTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public void testFrameworks(){ // First, get an instance of JObjC: final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance(); // It's your gateway to the frameworks. final FoundationFramework FND = JOBJC.Foundation(); final AppKitFramework APP = JOBJC.AppKit(); // From which you can then access... // enums, defines, constants int nsmye = FND.NSMaxYEdge(); boolean debug = FND.NSDebugEnabled(); // structs NSPoint p = FND.makeNSPoint(); p.setX(3); assertEquals(3.0, p.x()); // C functions NSPoint p2 = FND.NSMakePoint(12, 34); assertEquals(12.0, p2.x()); // ... Let's create an AutoreleasePool before we go on NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init(); // Objective-C classes NSStringClass nsc = FND.NSString(); // class-methods NSString nsStringClassDescr = nsc.description(); // instances NSString nsi = ((NSString) FND.NSString().alloc()).init(); // instance methods NSString d = nsi.description(); // The bridge marshals some types for you, but it doesn't // convert between NSString and Java String automatically. // For that we use Utils.get().strings().nsString(String) // and Utils.get().strings().javaString(NSString); assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr)); NSString format = Utils.get().strings().nsString("Foo bar %d baz"); NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34); String jformatted = Utils.get().strings().javaString(formatted); assertEquals("Foo bar 34 baz", jformatted); // Reveal in Finder // NSString file = Utils.get().strings().nsString( // "/Applications/Calculator.app/Contents/Resources/Calculator.icns"); // APP.NSWorkspace().sharedWorkspace() // .selectFile_inFileViewerRootedAtPath(file, null); pool.drain(); }