本文整理了Java中javax.swing.JEditorPane.setBorder()
方法的一些代码示例,展示了JEditorPane.setBorder()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JEditorPane.setBorder()
方法的具体详情如下:
包路径:javax.swing.JEditorPane
类名称:JEditorPane
方法名:setBorder
暂无
代码示例来源: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: nodebox/nodebox
notesArea.setEditable(false);
notesArea.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
notesArea.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
JScrollPane notesScroll = new JScrollPane(notesArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
notesScroll.setBorder(BorderFactory.createLineBorder(new Color(137, 137, 137)));
代码示例来源:origin: ron190/jsql-injection
text[0].setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
text[0].setDragEnabled(true);
text[0].setEditable(false);
代码示例来源:origin: bobbylight/RSyntaxTextArea
textArea.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
代码示例来源:origin: stackoverflow.com
JEditorPane editor = new JEditorPane();
editor.setBorder(BorderFactory.createLineBorder(Color.RED, 1));
editor.setText("..large text block..");
JScrollPane scrollPane = new JScrollPane(editor);
JPanel panel = new JPanel();
BoxLayout layout = new BoxLayout(panel, BoxLayout.Y_AXIS);
panel.setLayout(layout);
panel.add(Box.createVerticalGlue());
panel.add(scrollPane);
panel.add(Box.createVerticalGlue());
JFrame frame = new JFrame();
frame.setSize(600, 400);
frame.add(panel);
frame.setVisible(true);
代码示例来源:origin: stackoverflow.com
public class TestPane extends JPanel {
public TestPane() {
JEditorPane field = new JEditorPane();
field.setContentType("text/html");
field.setText("<html><a href='https://google.com'>Google it</a></html>");
field.setEditable(false);
field.setBorder(null);
field.setOpaque(false);
setLayout(new GridBagLayout());
add(field);
}
}
代码示例来源:origin: sing-group/GC4S
private JEditorPane getTestsInfo() {
JEditorPane testsInfo = new JEditorPane();
testsInfo.setContentType("text/html");
testsInfo.setEditable(false);
testsInfo.setText(getTestsText());
testsInfo.setBorder(createEmptyBorder(10, 5, 10, 5));
testsInfo.setBackground(getColor("Panel.background"));
return testsInfo;
}
代码示例来源:origin: net.sourceforge.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: stackoverflow.com
JEditorPane pane = new JEditorPane();
pane.setBorder(null);
pane.setSize(w, h);
pane.setContentType("text/html");
pane.setEditable(false);
pane.setText(html);
pane.paint(g2);
代码示例来源:origin: protegeproject/protege
private void createTextPanel() {
JEditorPane pane = new JEditorPane();
pane.setBorder(new EmptyBorder(12, 12, 12, 12));
pane.setPreferredSize(new Dimension(300, 200));
pane.setEditable(false);
pane.addHyperlinkListener(event -> {
if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED &&
event.getURL() != null) {
NativeBrowserLauncher.openURL(event.getURL().toString());
}
});
}
代码示例来源:origin: org.protege/protege-editor-core-application
private JEditorPane createTextPanel() {
JEditorPane pane = new JEditorPane();
pane.setBorder(new EmptyBorder(12, 12, 12, 12));
pane.setPreferredSize(new Dimension(300, 200));
pane.setEditable(false);
pane.setFont(new Font("SansSerif", Font.PLAIN, 9));
pane.addHyperlinkListener(new HyperlinkListener(){
public void hyperlinkUpdate(HyperlinkEvent event) {
if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED &&
event.getURL() != null) {
NativeBrowserLauncher.openURL(event.getURL().toString());
}
}
});
return pane;
}
代码示例来源:origin: edu.stanford.protege/org.protege.editor.core.application
private JEditorPane createTextPanel() {
JEditorPane pane = new JEditorPane();
pane.setBorder(new EmptyBorder(12, 12, 12, 12));
pane.setPreferredSize(new Dimension(300, 200));
pane.setEditable(false);
pane.setFont(new Font("SansSerif", Font.PLAIN, 9));
pane.addHyperlinkListener(new HyperlinkListener(){
public void hyperlinkUpdate(HyperlinkEvent event) {
if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED &&
event.getURL() != null) {
NativeBrowserLauncher.openURL(event.getURL().toString());
}
}
});
return pane;
}
代码示例来源:origin: protegeproject/protege
public ErrorPanel(final ErrorExplainer.ErrorExplanation<? extends O> explanation, URI loc) {
setLayout(new BorderLayout(12, 12));
setBorder(new EmptyBorder(7, 7, 7, 7));
JEditorPane errorMessagePanel = new JEditorPane();
errorMessagePanel.setEditable(false);
errorMessagePanel.setText(explanation.getMessage());
errorMessagePanel.setBorder(new EmptyBorder(7, 7, 7, 7));
JScrollPane errorScroller = new JScrollPane(errorMessagePanel);
stackTracePane = new JTextArea(20, 60);
setErrorMessage(stackTracePane, explanation.getCause());
stackTracePane.setBorder(new EmptyBorder(7, 7, 7, 7));
JScrollPane stackTraceScroller = new JScrollPane(stackTracePane);
tabs = new JTabbedPane();
tabs.addTab("Error", errorScroller);
tabs.addTab("Stack Trace", stackTraceScroller);
add(tabs, BorderLayout.CENTER);
}
代码示例来源:origin: edu.stanford.protege/org.protege.editor.owl
public ErrorPanel(final ErrorExplainer.ErrorExplanation<O> explanation, URI loc) {
setLayout(new BorderLayout(12, 12));
setBorder(new EmptyBorder(7, 7, 7, 7));
JEditorPane errorMessagePanel = new JEditorPane();
errorMessagePanel.setEditable(false);
errorMessagePanel.setText(explanation.getMessage());
errorMessagePanel.setBorder(new EmptyBorder(7, 7, 7, 7));
JScrollPane errorScroller = new JScrollPane(errorMessagePanel);
stackTracePane = new JTextArea(20, 60);
setErrorMessage(stackTracePane, explanation.getCause());
stackTracePane.setBorder(new EmptyBorder(7, 7, 7, 7));
JScrollPane stackTraceScroller = new JScrollPane(stackTracePane);
tabs = new JTabbedPane();
tabs.addTab("Error", errorScroller);
tabs.addTab("Stack Trace", stackTraceScroller);
add(tabs, BorderLayout.CENTER);
}
代码示例来源:origin: org.protege/protege-editor-owl
public ErrorPanel(final ErrorExplainer.ErrorExplanation<O> explanation, URI loc) {
setLayout(new BorderLayout(12, 12));
setBorder(new EmptyBorder(7, 7, 7, 7));
JEditorPane errorMessagePanel = new JEditorPane();
errorMessagePanel.setEditable(false);
errorMessagePanel.setText(explanation.getMessage());
errorMessagePanel.setBorder(new EmptyBorder(7, 7, 7, 7));
JScrollPane errorScroller = new JScrollPane(errorMessagePanel);
stackTracePane = new JTextArea(20, 60);
setErrorMessage(stackTracePane, explanation.getCause());
stackTracePane.setBorder(new EmptyBorder(7, 7, 7, 7));
JScrollPane stackTraceScroller = new JScrollPane(stackTracePane);
tabs = new JTabbedPane();
tabs.addTab("Error", errorScroller);
tabs.addTab("Stack Trace", stackTraceScroller);
add(tabs, BorderLayout.CENTER);
}
代码示例来源:origin: edu.stanford.protege/protege-editor-owl
public ErrorPanel(final ErrorExplainer.ErrorExplanation<? extends O> explanation, URI loc) {
setLayout(new BorderLayout(12, 12));
setBorder(new EmptyBorder(7, 7, 7, 7));
JEditorPane errorMessagePanel = new JEditorPane();
errorMessagePanel.setEditable(false);
errorMessagePanel.setText(explanation.getMessage());
errorMessagePanel.setBorder(new EmptyBorder(7, 7, 7, 7));
JScrollPane errorScroller = new JScrollPane(errorMessagePanel);
stackTracePane = new JTextArea(20, 60);
setErrorMessage(stackTracePane, explanation.getCause());
stackTracePane.setBorder(new EmptyBorder(7, 7, 7, 7));
JScrollPane stackTraceScroller = new JScrollPane(stackTracePane);
tabs = new JTabbedPane();
tabs.addTab("Error", errorScroller);
tabs.addTab("Stack Trace", stackTraceScroller);
add(tabs, BorderLayout.CENTER);
}
代码示例来源:origin: GoldenGnu/jeveassets
private JEditorPane createEditorPane(final boolean addBorder, final String text) {
JEditorPane jEditorPane = new JEditorPane("text/html",
"<html><div style=\"font-family: Arial, Helvetica, sans-serif; font-size: 11pt;\">"
+ text
+ "</div>"
);
jEditorPane.setEditable(false);
jEditorPane.setOpaque(false);
jEditorPane.addHyperlinkListener(DesktopUtil.getHyperlinkListener(getDialog()));
if (addBorder) {
jEditorPane.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(jPanel.getBackground().darker(), 1),
BorderFactory.createEmptyBorder(10, 10, 10, 10)));
}
return jEditorPane;
}
代码示例来源:origin: SonarSource/sonarlint-intellij
private JEditorPane createEditor() {
JEditorPane newEditor = new JEditorPane();
newEditor.setEditorKit(kit);
newEditor.setBorder(new EmptyBorder(10, 10, 10, 10));
newEditor.setEditable(false);
newEditor.setContentType("text/html");
newEditor.addHyperlinkListener(e -> {
if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) {
Desktop desktop = Desktop.getDesktop();
try {
desktop.browse(e.getURL().toURI());
} catch (Exception ex) {
SonarLintConsole.get(project).error("Error opening browser: " + e.getURL(), ex);
}
}
});
return newEditor;
}
代码示例来源:origin: com.github.insubstantial/substance-swingx
@Override
protected void installComponents() {
super.installComponents();
this.errorMessage.setBorder(null);
this.errorScrollPane.setOpaque(false);
this.errorScrollPane.getViewport().setOpaque(false);
this.iconGlowTracker = new IconGlowTracker(this.iconLabel);
}
内容来源于网络,如有侵权,请联系作者删除!