本文整理了Java中javax.swing.JEditorPane.setPreferredSize()
方法的一些代码示例,展示了JEditorPane.setPreferredSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JEditorPane.setPreferredSize()
方法的具体详情如下:
包路径:javax.swing.JEditorPane
类名称:JEditorPane
方法名:setPreferredSize
暂无
代码示例来源: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
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: 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: magefree/mage
txtDeckList.setPreferredSize(new Dimension(550, 400));
代码示例来源:origin: magefree/mage
txtDeckList.setPreferredSize(new Dimension(550, 400));
txtDeckList.setText(FORMAT_TEXT);
JScrollPane txtScrollableDeckList = new JScrollPane(txtDeckList);
代码示例来源:origin: bobbylight/RSyntaxTextArea
textArea.setPreferredSize(d);
textArea.setSize(d);
d.height = Math.min(d.height, maxWindowH);
textArea.setPreferredSize(d);
代码示例来源:origin: bcdev/beam
private JComponent createHelpPanel() {
JEditorPane helpPane = new JEditorPane("text/html", null);
helpPane.setEditable(false);
helpPane.setPreferredSize(new Dimension(400, 120));
helpPane.setText("<html><body>Copying the <b>definition</b> of a mask means the mathematical expression " +
"is evaluated in the target product. This is only possible, " +
"if the bands which are used in this expression are present in the target product.<br/> " +
"Copying the <b>pixel</b> means the data of the mask is transferred to the target product. " +
"This is only possible when both product overlap spatially.</body></html>");
JScrollPane helpPanelScrollPane = new JScrollPane(helpPane);
helpPanelScrollPane.setBorder(BorderFactory.createTitledBorder("Description"));
return helpPanelScrollPane;
}
代码示例来源:origin: senbox-org/snap-desktop
private JComponent createHelpPanel() {
JEditorPane helpPane = new JEditorPane("text/html", null);
helpPane.setEditable(false);
helpPane.setPreferredSize(new Dimension(400, 120));
helpPane.setText("<html><body>Copying the <b>definition</b> of a mask means the mathematical expression " +
"is evaluated in the target product. This is only possible, " +
"if the bands which are used in this expression are present in the target product.<br/> " +
"Copying the <b>pixel</b> means the data of the mask is transferred to the target product. " +
"This is only possible when both product overlap spatially.</body></html>");
JScrollPane helpPanelScrollPane = new JScrollPane(helpPane);
helpPanelScrollPane.setBorder(BorderFactory.createTitledBorder("Description"));
return helpPanelScrollPane;
}
代码示例来源:origin: de.dfki.mary/marytts-builder
public HelpGUI(String text) {
editPane = new JEditorPane();
editPane.setPreferredSize(new Dimension(700, 500));
editPane.setContentType("text/html; charset=UTF-8");
editPane.setText(text);
editPane.setEditable(false);
}
代码示例来源:origin: stackoverflow.com
JEditorPane jEditorPane = new JEditorPane();
jEditorPane.setEditable(false);
jEditorPane.setContentType("text/html");
jEditorPane.setText(toolTipText);
jEditorPane.setPreferredSize(new Dimension(800, 600));
代码示例来源: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: 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
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.netbeans.modules/org-netbeans-core
/** This method is called from within the constructor to
* initialize the form.
*/
private void initComponents() {
setLayout(new BorderLayout());
editorPane = new JEditorPane();
editorPane.setContentType("text/x-properties"); // NOI18N
// XXX pretty arbitrary! No way to set by rows & columns??
editorPane.setPreferredSize(new Dimension(200, 100));
add(new JScrollPane(editorPane), BorderLayout.CENTER);
warnings = new JTextField(30);
warnings.setEditable(false);
add(warnings, BorderLayout.SOUTH);
}
}
代码示例来源: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: org.jvnet.hudson.plugins.hudsontrayapp/client-common
/**
* This method initializes descriptionEditorPane
*
* @return javax.swing.JEditorPane
*/
private JEditorPane getDescriptionEditorPane() {
if (descriptionEditorPane == null) {
descriptionEditorPane = new JEditorPane();
descriptionEditorPane.setSize(new Dimension(546, 128));
descriptionEditorPane.setBackground(SystemColor.control);
descriptionEditorPane.setPreferredSize(new Dimension(48, 48));
descriptionEditorPane.setText("");
descriptionEditorPane.setEditable(false);
descriptionEditorPane.setContentType("text/html");
descriptionEditorPane.setFont(new Font("SansSerif", Font.PLAIN, 12));
}
return descriptionEditorPane;
}
代码示例来源: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: onyxbits/dummydroid
public CheckinForm(NavigateAction forward, NavigateAction backward) {
super(forward, backward);
result = new HypertextPane("");
result.setPreferredSize(new Dimension(300, 200));
result.setOpaque(false);
progress = new JProgressBar();
progress.setIndeterminate(true);
progress.setVisible(false);
setLayout(new BorderLayout());
add(result, BorderLayout.CENTER);
add(progress, BorderLayout.NORTH);
}
代码示例来源:origin: org.scijava/scijava-ui-swing
public SwingTextDisplayPanel(final TextDisplay display,
final DisplayWindow window)
{
display.getContext().inject(this);
this.display = display;
this.window = window;
textArea = new JEditorPane();
textArea.setPreferredSize(new Dimension(600, 500));
textArea.setEditable(false);
final Font font = new Font(Font.MONOSPACED, Font.PLAIN, 12);
textArea.setFont(font);
textArea.addHyperlinkListener(this);
setViewportView(textArea);
window.setContent(this);
}
代码示例来源:origin: freeplane/freeplane
private void setTipTextUnsafe(String tipText) throws Exception{
tip.setSize(0, 0);
tip.setPreferredSize(null);
tip.setText(tipText);
((HTMLDocument)tip.getDocument()).setBase(baseUrl);
Dimension preferredSize = tip.getPreferredSize();
if (preferredSize.width > maximumWidth && contentType.equals(FreeplaneTooltip.TEXT_HTML)) {
final HTMLDocument document = (HTMLDocument) tip.getDocument();
document.getStyleSheet().addRule("body { width: " + maximumWidth + "}");
// bad hack: call "setEditable" only to update view
tip.setEditable(true);
tip.setEditable(false);
preferredSize = tip.getPreferredSize();
if (preferredSize.width > maximumWidth) {
}
}
tip.setSize(preferredSize);
preferredSize = tip.getPreferredSize();
tip.setPreferredSize(preferredSize);
}
内容来源于网络,如有侵权,请联系作者删除!