我正在尝试使用
在JavaFx中实现代码编辑器https://gist.github.com/jewelsea/1463485
但问题是它从互联网下载CSS / Javascript以加载CodeMirror。有没有办法下载这些文件并将它们放在Netbeans本地加载它们?我对Java很有经验,但不是JavaFX或HTML。
我
答案 0 :(得分:0)
请将CSS / Javascript放在类路径中并使用以下代码:
private final String editingTemplate =
"<!doctype html>" +
"<html>" +
"<head>" +
" <link rel=\"stylesheet\" href=\"codemirror.css\">" +
" <script src=\"codemirror.js\"></script>" +
" <script src=\"clike.js\"></script>" +
"</head>" +
"<body>" +
"<form><textarea id=\"code\" name=\"code\">\n" +
"${code}" +
"</textarea></form>" +
"<script>" +
" var editor = CodeMirror.fromTextArea(document.getElementById(\"code\"), {" +
" lineNumbers: true," +
" matchBrackets: true," +
" mode: \"text/x-java\"" +
" });" +
"</script>" +
"</body>" +
"</html>";
我只是想从类路径而不是互联网中选择CSS / Javascript