Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

43 lines (35 sloc) 1.428 kb
import "AppKit"
nsapp = NSApplication sharedApplication
\ Create the menubar
quitMenuItem = NSMenuItem new setTitle: "Quit «NSProcessInfo processInfo processName»";
setAction: #terminate:;
setKeyEquivalent: #q;
appMenu = NSMenu new addItem: quitMenuItem; self
appMenuItem = NSMenuItem new setSubmenu: appMenu; self
menuBar = NSMenu new addItem: appMenuItem; self
nsapp setMainMenu: menuBar
\ Create a little view
@TestView < NSView {
- init {
@gradient = NSGradient alloc initWithStartingColor: NSColor redColor
endingColor: NSColor yellowColor
- drawRect: dirtyRect {
@gradient drawInRect: dirtyRect angle: 45
\ Create a window
win = (NSWindow alloc initWithContentRect: [NSZeroPoint, [300, 200]]
styleMask: (NSTitledWindowMask bitOr: NSResizableWindowMask)
backing: NSBackingStoreBuffered
defer: no)
setTitle: "Tranquil!";
setContentView: TestView new;
\ Start the app
win makeKeyAndOrderFront: nil
nsapp setActivationPolicy: NSApplicationActivationPolicyRegular
nsapp activateIgnoringOtherApps: yes
nsapp run
Jump to Line
Something went wrong with that request. Please try again.