OVH Cloud OVH Cloud

[Cocoa-Java] NSTextView et HTML

2 réponses
Avatar
une.bevueVOTEZ
je cherche des infos sur NSTextView et HTML càd quel est le html
supporté (avec ou sans css, avec ou sans js) ???

--
une bévue

2 réponses

Avatar
gilles
je cherche des infos sur NSTextView et HTML càd quel est le html
supporté (avec ou sans css, avec ou sans js) ???


Je ne suis pas sûr qu'il y en ait...

Avatar
une.bevueVOTEZ
gilles wrote:

Je ne suis pas sûr qu'il y en ait...


si, ça marche, des extraits :

public void appendHtmlText(String theText) {
NSData htmlData = new NSData(theText.getBytes());
NSAttributedString s = new NSAttributedString(((NSData)
htmlData),
new NSMutableDictionary());
myText.textStorage().setAttributedString(s);
}

public void awakeFromNib() {
FilesTK.init();
appendHtmlText(Html.open() + Locations.getHtml() +
Bottles.getHtml() + Html.close());
}



avec :

public class Html {

public static String open() {
String line = "<html>n";
line += " <head>n";
line += " <title>Liste des bouteilles</title>n";
line += " <meta http-equiv='Content-type'
content='text/html; charset=utf-8' />n";
line += " <style type='text/css'>n";
line += " h1 {color : red;}n";
line += " </style>n";
line += " </head>n";
line += " <body>n";
return line;
}

public static String close() {
String line = " </body>n</html>n";
return line;
}

--
une bévue