Skip to content

Instantly share code, notes, and snippets.

@wilkes
Created November 2, 2009 15:37
Show Gist options
  • Save wilkes/224226 to your computer and use it in GitHub Desktop.
Save wilkes/224226 to your computer and use it in GitHub Desktop.
/*
* AppController.j
* scrollview
*
* Created by You on November 2, 2009.
* Copyright 2009, Your Company All rights reserved.
*/
@import <Foundation/CPObject.j>
@implementation AppController : CPObject
{
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(40, 40, 400,200)
styleMask:CPResizableWindowMask | CPTitledWindowMask | CPClosableWindowMask | CPMiniaturizableWindowMask],
contentView = [theWindow contentView];
[contentView setBackgroundColor: [CPColor yellowColor]];
var scrollView = [[CPScrollView alloc] initWithFrame:[contentView bounds]];
[scrollView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[contentView addSubview:scrollView];
[scrollView setBackgroundColor: [CPColor greenColor]];
var label = [[CPTextField alloc] initWithFrame:CGRectMakeZero()];
[label setStringValue:@"Hello World!"];
[label setFont:[CPFont boldSystemFontOfSize:24.0]];
[label setBackgroundColor: [CPColor redColor]];
[label sizeToFit];
[label setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin];
[label setCenter:[scrollView center]];
[scrollView addSubview:label];
[theWindow orderFront:self];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment