Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Strange problem with NSTextView (was NSTextView colors & styles)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Strange problem with NSTextView (was NSTextView colors & styles)



Ok... now seems all ok:

String input = "kkkk";
NSColor color = NSColor.blueColor();
NSDictionary dict = new NSDictionary(color,NSAttributedString.ForegroundColorAttributeName);
NSAttributedString attstring = new NSAttributedString(input,dict);
main_chatbox.insertText(attstring);

The text is blue. Now i would to set the color and the font size/name.
I have created two NSMutableArray with keys and values. Then i have created my dictionary... so:

NSColor color = NSColor.blueColor();
NSFont fonts = NSFont.fontWithNameAndSize("Courier",9);
NSMutableArray val = new NSMutableArray();
NSMutableArray ke = new NSMutableArray();
val.addObject(color);
val.addObject(fonts);
ke.addObject(NSAttributedString.ForegroundColorAttributeName);
ke.addObject(NSAttributedString.FontAttributeName);
NSDictionary dict = new NSDictionary(val,ke);
NSAttributedString attstring = new NSAttributedString(input,dict);
main_chatbox.insertText(attstring);

With this code all is black... nothing about the color/font size&name...why? Thx at all.
Daniele
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.