本文整理了Java中javax.swing.JEditorPane.setEditable()
方法的一些代码示例,展示了JEditorPane.setEditable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JEditorPane.setEditable()
方法的具体详情如下:
包路径:javax.swing.JEditorPane
类名称:JEditorPane
方法名:setEditable
暂无
代码示例来源:origin: stackoverflow.com
final JEditorPane editor = new JEditorPane();
editor.setEditorKit(JEditorPane.createEditorKitForContentType("text/html"));
editor.setEditable(false);
代码示例来源:origin: log4j/log4j
/**
* Creates a new <code>DetailPanel</code> instance.
*
* @param aTable the table to listen for selections on
* @param aModel the model backing the table
*/
DetailPanel(JTable aTable, final MyTableModel aModel) {
mModel = aModel;
setLayout(new BorderLayout());
setBorder(BorderFactory.createTitledBorder("Details: "));
mDetails = new JEditorPane();
mDetails.setEditable(false);
mDetails.setContentType("text/html");
add(new JScrollPane(mDetails), BorderLayout.CENTER);
final ListSelectionModel rowSM = aTable.getSelectionModel();
rowSM.addListSelectionListener(this);
}
代码示例来源:origin: stanfordnlp/CoreNLP
private void displayTsurgeonHelp() {
if(tsurgeonHelpFrame != null) {
tsurgeonHelpFrame.setVisible(true);
} else {
tsurgeonHelpFrame = new JFrame("TSurgeon Help...");
JEditorPane helpText = new JEditorPane();
helpText.setContentType("text/html");
// StringBuffer s = new StringBuffer();
// s.append(htmlTsurgeonHelp);
helpText.setText(htmlTsurgeonHelp);
helpText.setEditable(false);
JScrollPane scroller = new JScrollPane(helpText);
helpText.setCaretPosition(0);
scroller.setPreferredSize(new Dimension(500,500));
tsurgeonHelpFrame.add(scroller);
tsurgeonHelpFrame.pack();
tsurgeonHelpFrame.setBackground(Color.WHITE);
tsurgeonHelpFrame.setVisible(true);
}
}
代码示例来源:origin: stanfordnlp/CoreNLP
private void displayHelp() {
if (helpFrame != null) {
helpFrame.setVisible(true);
} else {
helpFrame = new JFrame("Tregex Help...");
//JPanel helpPanel = new JPanel();
JEditorPane helpText = new JEditorPane();
helpText.setContentType("text/html");
// StringBuffer s = new StringBuffer();
// s.append(htmlHelp);
helpText.setText(htmlHelp);
helpText.setEditable(false);
//helpPanel.add(helpText);
JScrollPane scroller = new JScrollPane(helpText);
helpText.setCaretPosition(0);
scroller.setPreferredSize(new Dimension(500,500));
helpFrame.add(scroller);
helpFrame.pack();
helpFrame.setBackground(Color.WHITE);
helpFrame.setVisible(true);
//helpFrame.repaint();
}
}
代码示例来源:origin: stanfordnlp/CoreNLP
private void buildContentPanel() {
editorPane = new JEditorPane ();
editorPane.setContentType("text/rtf");
editorPane.addKeyListener(new InputListener());
// defaultAttrSet = ((StyledEditorKit)editorPane.getEditorKit()).getInputAttributes();
StyleConstants.setFontFamily(defaultAttrSet, "Lucinda Sans");
Document doc = new DefaultStyledDocument();
editorPane.setDocument(doc);
try {
doc.insertString(0, initText, defaultAttrSet);
} catch (Exception ex) {
throw new RuntimeException(ex);
}
JScrollPane scrollPane = new JScrollPane(editorPane);
frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
editorPane.setEditable(true);
}
代码示例来源:origin: stanfordnlp/CoreNLP
private void buildContentPanel() {
editorPane = new JEditorPane ();
editorPane.setContentType("text/rtf");
editorPane.addKeyListener(new InputListener());
// defaultAttrSet = ((StyledEditorKit)editorPane.getEditorKit()).getInputAttributes();
StyleConstants.setFontFamily(defaultAttrSet, "Lucida Sans");
Document doc = new DefaultStyledDocument();
editorPane.setDocument(doc);
try {
doc.insertString(0, initText, defaultAttrSet);
} catch (Exception ex) {
throw new RuntimeException(ex);
}
JScrollPane scrollPane = new JScrollPane(editorPane);
frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
editorPane.setEditable(true);
}
代码示例来源:origin: plantuml/plantuml
private JComponent getJComponent(List<String> lines) {
final StringBuilder sb = new StringBuilder("<html>");
for (String s : lines) {
sb.append(s + "</b></i></u>");
sb.append("<br>");
}
sb.append("</html>");
final JEditorPane text = new JEditorPane("text/html", sb.toString());
text.setEditable(false);
CompoundBorder border = new CompoundBorder(BorderFactory.createEtchedBorder(BevelBorder.RAISED),
BorderFactory.createEmptyBorder(5, 5, 5, 5));
border = new CompoundBorder(BorderFactory.createMatteBorder(5, 5, 5, 5, getBackground()), border);
text.setBorder(border);
return text;
}
代码示例来源:origin: plantuml/plantuml
private JComponent getJComponent(List<String> lines) {
final StringBuilder sb = new StringBuilder("<html>");
for (String s : lines) {
sb.append(s + "</b></i></u>");
sb.append("<br>");
}
sb.append("</html>");
final JEditorPane text = new JEditorPane("text/html", sb.toString());
text.setEditable(false);
CompoundBorder border = new CompoundBorder(BorderFactory.createEtchedBorder(BevelBorder.RAISED),
BorderFactory.createEmptyBorder(5, 5, 5, 5));
border = new CompoundBorder(BorderFactory.createMatteBorder(5, 5, 5, 5, getBackground()), border);
text.setBorder(border);
final JScrollPane jScrollPane = new JScrollPane(text, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
jScrollPane.getVerticalScrollBar().setValue(0);
}
});
return jScrollPane;
}
代码示例来源:origin: libgdx/libgdx
infoLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
panel.add(infoLabel);
JEditorPane pane = new JEditorPane("text/html", "<a href=\"https://github.com/libgdx/libgdx/wiki/Dependency-management-with-Gradle\">Dependency Management</a>");
pane.addHyperlinkListener(new HyperlinkListener() {
@Override
pane.setEditable(false);
pane.setOpaque(false);
pane.setAlignmentX(Component.CENTER_ALIGNMENT);
代码示例来源:origin: SonarSource/sonarqube
tabbedPane.addTab("Component details", null, componentDetailsTab, null);
componentEditor = new JEditorPane();
componentDetailsTab.setViewportView(componentEditor);
sourceEditor.setEditable(false);
sourceTab.setViewportView(sourceEditor);
tabbedPane.addTab("Highlighting", null, highlightingTab, null);
highlightingEditor = new JEditorPane();
highlightingTab.setViewportView(highlightingEditor);
tabbedPane.addTab("Symbol references", null, symbolTab, null);
symbolEditor = new JEditorPane();
symbolTab.setViewportView(symbolEditor);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
setSize(800, 600);
chatLog = new JEditorPane();
chatLog.setEditable(false);
chatLog.setContentType("text/html");
chatLog.setText("<html><body>");
代码示例来源:origin: RipMeApp/ripme
if (UpdateUtils.isNewerVersion(latestVersion)) {
logger.info("Found newer version: " + latestVersion);
JEditorPane changeListPane = new JEditorPane("text/html", String.format(
"<html><font color=\"green\">New version (%s) is available!</font>" + "<br><br>Recent changes: %s"
+ "<br><br>Do you want to download and run the newest version?</html>",
latestVersion, changeList.replaceAll("\\n", "<br><br>")));
changeListPane.setEditable(false);
JScrollPane changeListScrollPane = new JScrollPane(changeListPane);
changeListScrollPane.setPreferredSize(new Dimension(300, 300));
代码示例来源:origin: apache/pdfbox
/**
* Creates a non-editable widget to display the error message.
*
*/
final JComponent createErrorMessage(Throwable t)
{
String txt = t.getLocalizedMessage();
JEditorPane msg = new JEditorPane();
msg.setContentType("text/plain");
msg.setEditable(false);
msg.setText(txt);
return msg;
}
代码示例来源:origin: stackoverflow.com
JEditorPane jep = new JEditorPane();
jep.setEditable(false);
try {
jep.setPage("http://www.yoursite.com");
}catch (IOException e) {
jep.setContentType("text/html");
jep.setText("<html>Could not load</html>");
}
JScrollPane scrollPane = new JScrollPane(jep);
JFrame f = new JFrame("Test HTML");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(scrollPane);
f.setPreferredSize(new Dimension(800,600));
f.setVisible(true);
代码示例来源:origin: apache/tika
private void handleError(String name, Throwable t) {
StringWriter writer = new StringWriter();
writer.append("Apache Tika was unable to parse the document\n");
writer.append("at " + name + ".\n\n");
writer.append("The full exception stack trace is included below:\n\n");
t.printStackTrace(new PrintWriter(writer));
JEditorPane editor =
new JEditorPane("text/plain", writer.toString());
editor.setEditable(false);
editor.setBackground(Color.WHITE);
editor.setCaretPosition(0);
editor.setPreferredSize(new Dimension(600, 400));
JDialog dialog = new JDialog(this, "Apache Tika error");
dialog.add(new JScrollPane(editor));
dialog.pack();
dialog.setVisible(true);
}
代码示例来源:origin: apache/tika
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == EventType.ACTIVATED) {
try {
URL url = e.getURL();
try (InputStream stream = url.openStream()) {
JEditorPane editor =
new JEditorPane("text/plain", IOUtils.toString(stream, UTF_8));
editor.setEditable(false);
editor.setBackground(Color.WHITE);
editor.setCaretPosition(0);
editor.setPreferredSize(new Dimension(600, 400));
String name = url.toString();
name = name.substring(name.lastIndexOf('/') + 1);
JDialog dialog = new JDialog(this, "Apache Tika: " + name);
dialog.add(new JScrollPane(editor));
dialog.pack();
dialog.setVisible(true);
}
} catch (IOException exception) {
exception.printStackTrace();
}
}
}
代码示例来源:origin: apache/tika
private void addWelcomeCard(JPanel panel, String name) {
try {
JEditorPane editor =
new JEditorPane(TikaGUI.class.getResource("welcome.html"));
editor.setContentType("text/html");
editor.setEditable(false);
editor.setBackground(Color.WHITE);
editor.setTransferHandler(new ParsingTransferHandler(
editor.getTransferHandler(), this));
panel.add(new JScrollPane(editor), name);
} catch (IOException e) {
e.printStackTrace();
}
}
代码示例来源:origin: apache/tika
private void textDialog(String title, URL resource) {
try {
JDialog dialog = new JDialog(this, title);
JEditorPane editor = new JEditorPane(resource);
editor.setContentType("text/html");
editor.setEditable(false);
editor.setBackground(Color.WHITE);
editor.setPreferredSize(new Dimension(400, 250));
editor.addHyperlinkListener(this);
dialog.add(editor);
dialog.pack();
dialog.setVisible(true);
} catch (IOException e) {
e.printStackTrace();
}
}
代码示例来源:origin: Nilhcem/FakeSMTP
JEditorPane ep = new JEditorPane("text/html",
String.format("<html><body style=\"%s\">%s<br /><a href=\"%s\">%s</a></body></html>",
style, i18n.get("menubar.about.dialog"), link, link));
ep.setEditable(false);
ep.setBackground(label.getBackground());
代码示例来源:origin: pentaho/mondrian
MondrianServerRegistry.INSTANCE.getCopyrightYear());
JEditorPane jEditorPane =
new JEditorPane("text/html", ver);
jEditorPane.setEditable(false);
JScrollPane jScrollPane = new JScrollPane(jEditorPane);
JPanel jPanel = new JPanel();
内容来源于网络,如有侵权,请联系作者删除!