本文整理汇总了Java中org.eclipse.swt.internal.cocoa.NSString类的典型用法代码示例。如果您正苦于以下问题:Java NSString类的具体用法?Java NSString怎么用?Java NSString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NSString类属于org.eclipse.swt.internal.cocoa包,在下文中一共展示了NSString类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNSStringValue
import org.eclipse.swt.internal.cocoa.NSString; //导入依赖的package包/类
public static final String getNSStringValue( long pointer ) throws Throwable {
NSString nsString = new NSString();
NSString.class.getField("id").set(nsString, osType(pointer) );
return nsString.getString();
}
示例2: init
import org.eclipse.swt.internal.cocoa.NSString; //导入依赖的package包/类
public void init( Shell shell ) throws Throwable{
Callback callback = TGCocoa.newCallback( this , "callbackProc64", "callbackProc32", 3 );
long callbackProc = TGCocoa.getCallbackAddress( callback );
if( callbackProc != 0 ){
String classname = ("MacToolbarDelegate");
if( TGCocoa.objc_lookUpClass ( classname ) == 0 ) {
long cls = TGCocoa.objc_allocateClassPair( classname , 0 ) ;
TGCocoa.class_addIvar(cls, SWT_OBJECT, C.PTR_SIZEOF , (byte)(C.PTR_SIZEOF == 4 ? 2 : 3), new byte[]{'*','\0'} );
TGCocoa.class_addMethod(cls, sel_toolbarButtonClicked_, callbackProc , "@:@");
TGCocoa.objc_registerClassPair(cls);
}
this.delegate = TGCocoa.newMacToolbarDelegate();
this.delegate.alloc().init();
this.delegateRef = TGCocoa.NewGlobalRef( MacToolbar.this );
TGCocoa.object_setInstanceVariable( MacToolbarDelegate.class.getField("id").get( delegate ) , SWT_OBJECT , this.delegateRef );
NSToolbar dummyBar = new NSToolbar();
dummyBar.alloc();
dummyBar.initWithIdentifier(NSString.stringWith("SWTToolbar")); //$NON-NLS-1$
dummyBar.setVisible(false);
NSWindow nsWindow = shell.view.window();
nsWindow.setToolbar(dummyBar);
dummyBar.release();
nsWindow.setShowsToolbarButton(true);
NSButton toolbarButton = TGCocoa.getStandardWindowButton(nsWindow, NSWindowToolbarButton);
if (toolbarButton != null) {
toolbarButton.setTarget( delegate );
TGCocoa.setControlAction( toolbarButton , sel_toolbarButtonClicked_ );
}
}
}