+ field = [[NSTextField alloc] initWithFrame:self.bounds];
+ field.alignment = NSCenterTextAlignment;
+ field.editable = NO;
+ field.selectable = NO;
+ field.delegate = self;
+ [self addSubview:field];
+
+ warning = [[NSImageView alloc] init];
+ warning.image = [NSImage imageNamed:@"NSInvalidDataFreestanding"];
+ CGSize imgSize = warning.image.size;
+ CGRect bounds = self.bounds;
+ warning.frame = CGRectMake(bounds.size.width - (imgSize.width + 4),
+ (bounds.size.height - imgSize.height) / 2,
+ imgSize.width, imgSize.height);
+
+ warning.toolTip = NSLocalizedString(@"invalid key code",
+ @"shown when the user types an invalid key code");
+ warning.hidden = YES;
+ [self addSubview:warning];