本文整理了Java中javax.swing.JEditorPane.read()
方法的一些代码示例,展示了JEditorPane.read()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JEditorPane.read()
方法的具体详情如下:
包路径:javax.swing.JEditorPane
类名称:JEditorPane
方法名:read
暂无
代码示例来源:origin: pentaho/mondrian
jEditorPaneXML.read(new StringReader(sxml.toString()), null);
jEditorPaneXML.getDocument().putProperty(
PlainDocument.tabSizeAttribute,
代码示例来源:origin: org.wildfly.core/wildfly-cli
private void readHelpFile(String helpFile) throws IOException {
InputStream in = getClass().getResourceAsStream("/help/" + helpFile);
JEditorPane helpText = new JEditorPane();
helpText.read(in, null);
helpText.setEditable(false);
helpScroller = new JScrollPane(helpText);
}
}
代码示例来源:origin: wildfly/wildfly-core
private void readHelpFile(String helpFile) throws IOException {
InputStream in = getClass().getResourceAsStream("/help/" + helpFile);
JEditorPane helpText = new JEditorPane();
helpText.read(in, null);
helpText.setEditable(false);
helpScroller = new JScrollPane(helpText);
}
}
代码示例来源:origin: de.dfki.mary/marytts-builder
public HelpGUI(InputStream fileIn) {
editPane = new JEditorPane();
editPane.setContentType("text/html; charset=UTF-8");
try {
editPane.read(new InputStreamReader(fileIn, "UTF-8"), null);
} catch (Exception e) {
e.printStackTrace();
System.out.println("Could not read file : " + e.getMessage());
}
editPane.setPreferredSize(new Dimension(700, 500));
editPane.setEditable(false);
}
代码示例来源:origin: SonarSource/sonarlint-intellij
private void setDescription(@Nullable RulesTreeNode.Rule rule) {
String html;
if (rule == null) {
html = "Select a rule to see the description";
} else {
String attributes = rule.severity() + " " + rule.type();
attributes = attributes.toLowerCase(Locale.US).replace('_', ' ');
html = "<b>" + rule.getKey() + "</b> | " + attributes + "<br/>" + rule.getHtmlDescription();
}
try {
descriptionBrowser.read(new StringReader(html), null);
} catch (IOException e) {
// ignore
}
}
代码示例来源:origin: org.nuiton/nuiton-widgets
@Override
public boolean open(File file) {
try {
Document doc = editor.getDocument();
EditorHelper.removeUndoRedoSupport(editor);
doc.removeDocumentListener(this);
Reader in = new BufferedReader(new FileReader(file));
editor.read(in, file);
doc = editor.getDocument();
doc.addDocumentListener(this);
EditorHelper.addUndoRedoSupport(editor);
isModified = false;
return true;
} catch (FileNotFoundException eee) {
if (log.isWarnEnabled()) {
log.warn("Can't find file: " + file, eee);
}
} catch (IOException eee) {
if (log.isWarnEnabled()) {
log.warn("Can't open file: " + file, eee);
}
}
return false;
}
代码示例来源:origin: de.dfki.mary/marytts-transcription
private void helpMenuItemActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_helpMenuItemActionPerformed
try {
htmlEditor.setContentType("text/html; charset=UTF-8");
htmlEditor
.read(new InputStreamReader(TranscriptionGUI.class.getResourceAsStream("instructions.html"), "UTF-8"), null);
htmlEditor.setPreferredSize(new Dimension(500, 400));
htmlEditor.setEditable(true);
htmlEditor.updateUI();
startUpHelpDialog.setSize(new Dimension(700, 500));
startUpHelpDialog.repaint();
closeHelp.grabFocus();
startUpHelpDialog.setVisible(true);
startUpHelpDialog.repaint();
} catch (IOException e) {
e.printStackTrace();
System.out.println("Could not read file : " + e.getMessage());
}
}// GEN-LAST:event_helpMenuItemActionPerformed
代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-widgets-extra
@Override
public boolean open(File file) {
try {
Document doc = editor.getDocument();
EditorHelper.removeUndoRedoSupport(editor);
doc.removeDocumentListener(this);
Reader in = new BufferedReader(new FileReader(file));
editor.read(in, file);
doc = editor.getDocument();
doc.addDocumentListener(this);
EditorHelper.addUndoRedoSupport(editor);
isModified = false;
return true;
} catch (FileNotFoundException eee) {
if (log.isWarnEnabled()) {
log.warn("Can't find file: " + file, eee);
}
} catch (IOException eee) {
if (log.isWarnEnabled()) {
log.warn("Can't open file: " + file, eee);
}
}
return false;
}
代码示例来源:origin: de.dfki.mary/marytts-builder
editPane.read(new InputStreamReader(new FileInputStream(file), "UTF-8"), null);
JButton saveButton = new JButton("Save & Exit");
saveButton.addActionListener(new ActionListener() {
代码示例来源:origin: de.sciss/jsyntaxpane
private void jCmbLangsItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jCmbLangsItemStateChanged
if (evt.getStateChange() == ItemEvent.SELECTED) {
String lang = jCmbLangs.getSelectedItem().toString();
// save the state of the current JEditorPane, as it's Document is about
// to be replaced.
String oldText = jEdtTest.getText();
// install a new DefaultSyntaxKit on the JEditorPane for the requested language.
jEdtTest.setContentType(lang);
// Recreate the Toolbar
jToolBar1.removeAll();
EditorKit kit = jEdtTest.getEditorKit();
if (kit instanceof DefaultSyntaxKit) {
DefaultSyntaxKit defaultSyntaxKit = (DefaultSyntaxKit) kit;
defaultSyntaxKit.addToolBarActions(jEdtTest, jToolBar1);
}
jToolBar1.validate();
try {
// setText should not be called (read the JavaDocs). Better use the read
// method and create a new document.
jEdtTest.read(new StringReader(oldText), lang);
} catch (IOException ex) {
Logger.getLogger(SyntaxTester.class.getName()).log(Level.SEVERE, null, ex);
}
}
jEdtTest.requestFocusInWindow();
}//GEN-LAST:event_jCmbLangsItemStateChanged
代码示例来源:origin: CallForSanity/Gaalop
welcomeToGaalopWelcomeEditorPane.read(getClass().getResourceAsStream("welcome.html"), null);
} catch (IOException e) {
log.error("Unable to read welcome document.");
内容来源于网络,如有侵权,请联系作者删除!