本文整理汇总了Java中com.apple.jobjc.foundation.NSAutoreleasePool类的典型用法代码示例。如果您正苦于以下问题:Java NSAutoreleasePool类的具体用法?Java NSAutoreleasePool怎么用?Java NSAutoreleasePool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NSAutoreleasePool类属于com.apple.jobjc.foundation包,在下文中一共展示了NSAutoreleasePool类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: main
import com.apple.jobjc.foundation.NSAutoreleasePool; //导入依赖的package包/类
public static void main(String[] args){
JObjCRuntime.getInstance().registerUserClass(MyDelegate.class, MyDelegateClass.class);
objc.AppKit().NSApplication().sharedApplication();
NSApplication app = objc.AppKit().NSApp();
NSAutoreleasePool pool = objc.Foundation().NSAutoreleasePool().alloc();
pool = pool.init();
app.setDelegate(new MyDelegateClass(JObjCRuntime.getInstance()).newID());
app.run();
pool.drain();
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:13,代码来源:GUIDemo.java
示例2: setUp
import com.apple.jobjc.foundation.NSAutoreleasePool; //导入依赖的package包/类
@Override public void setUp() throws Exception {
FoundationFramework foundation = JObjC.getInstance().Foundation();
pool = foundation.NSAutoreleasePool().alloc();
pool.init();
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:6,代码来源:PooledTestCase.java
示例3: testFrameworks
import com.apple.jobjc.foundation.NSAutoreleasePool; //导入依赖的package包/类
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();
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:61,代码来源:IntroTest.java
注:本文中的com.apple.jobjc.foundation.NSAutoreleasePool类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论