本文整理汇总了Java中net.sf.memoranda.ui.htmleditor.HTMLEditor类的典型用法代码示例。如果您正苦于以下问题:Java HTMLEditor类的具体用法?Java HTMLEditor怎么用?Java HTMLEditor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HTMLEditor类属于net.sf.memoranda.ui.htmleditor包,在下文中一共展示了HTMLEditor类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: HTMLFileImport
import net.sf.memoranda.ui.htmleditor.HTMLEditor; //导入依赖的package包/类
/**
* Constructor for HTMLFileImport.
*/
public HTMLFileImport(File f, HTMLEditor editor) {
StringBuilder builder = new StringBuilder();
try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(f)))) {
String line = in.readLine();
while (line != null) {
builder.append(line);
builder.append('\n');
line = in.readLine();
}
} catch (Exception e) {
new ExceptionDialog(e, "Failed to import " + f.getPath(), "");
return;
}
String text = builder.toString();
text = Pattern.compile("<body(.*?)>", java.util.regex.Pattern.DOTALL + java.util.regex.Pattern.CASE_INSENSITIVE)
.split(text)[1];
text = Pattern.compile("</body>", java.util.regex.Pattern.DOTALL + java.util.regex.Pattern.CASE_INSENSITIVE)
.split(text)[0];
editor.insertHTML(text, editor.editor.getCaretPosition());
}
示例2: HTMLFileImport
import net.sf.memoranda.ui.htmleditor.HTMLEditor; //导入依赖的package包/类
/**
* Constructor for HTMLFileImport.
*/
public HTMLFileImport(File f, HTMLEditor editor) {
String text = "";
BufferedReader in;
try {
//in = new BufferedReader(new InputStreamReader(new FileInputStream(f), "UTF-8"));
in = new BufferedReader(new InputStreamReader(new FileInputStream(f)));
String line = in.readLine();
while (line != null) {
text = text + line + "\n";
line = in.readLine();
}
in.close();
}
catch (Exception e) {
new ExceptionDialog(e, "Failed to import "+f.getPath(), "");
return;
}
text = Pattern.compile("<body(.*?)>", java.util.regex.Pattern.DOTALL + java.util.regex.Pattern.CASE_INSENSITIVE)
.split(text)[1];
text = Pattern.compile("</body>", java.util.regex.Pattern.DOTALL + java.util.regex.Pattern.CASE_INSENSITIVE)
.split(text)[0];
//text = text.substring(p1, p2);
editor.insertHTML(text, editor.editor.getCaretPosition());
}
示例3: HTMLFileImport
import net.sf.memoranda.ui.htmleditor.HTMLEditor; //导入依赖的package包/类
/**
* Constructor for HTMLFileImport.
*/
public HTMLFileImport(File f, HTMLEditor editor) {
String text = "";
BufferedReader in;
try {
// in = new BufferedReader(new InputStreamReader(new
// FileInputStream(f), "UTF-8"));
in = new BufferedReader(new InputStreamReader(new FileInputStream(f)));
String line = in.readLine();
while (line != null) {
text = text + line + "\n";
line = in.readLine();
}
in.close();
} catch (Exception e) {
new ExceptionDialog(e, "Failed to import " + f.getPath(), "");
return;
}
text = Pattern.compile("<body(.*?)>", java.util.regex.Pattern.DOTALL + java.util.regex.Pattern.CASE_INSENSITIVE)
.split(text)[1];
text = Pattern.compile("</body>", java.util.regex.Pattern.DOTALL + java.util.regex.Pattern.CASE_INSENSITIVE)
.split(text)[0];
// text = text.substring(p1, p2);
editor.insertHTML(text, editor.editor.getCaretPosition());
}