Skip to content

Instantly share code, notes, and snippets.

@thilo
Created May 3, 2009 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thilo/106139 to your computer and use it in GitHub Desktop.
Save thilo/106139 to your computer and use it in GitHub Desktop.
framework 'Cocoa'
app = NSApplication.sharedApplication
window = NSWindow.alloc.initWithContentRect([0,0,200,60],
styleMask:NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask ,
backing:NSBackingStoreBuffered,
defer:false)
window.title = 'Hello World'
label = NSTextField.alloc.initWithFrame(NSZeroRect)
window.contentView.addSubview(label)
label.stringValue = "Hello World!"
label.setEditable(false)
label.setSelectable(false)
label.setBezeled(false)
label.setDrawsBackground(false)
label.sizeToFit
label.frameOrigin = NSMakePoint((window.contentView.frameSize.width / 2 - (label.frameSize.width / 2)),
(window.contentView.frameSize.height / 3))
window.display
window.orderFrontRegardless
app.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment