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); }
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(); } }
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(); } } }
txtDeckList.setPreferredSize(new Dimension(550, 400));
txtDeckList.setPreferredSize(new Dimension(550, 400)); txtDeckList.setText(FORMAT_TEXT); JScrollPane txtScrollableDeckList = new JScrollPane(txtDeckList);
textArea.setPreferredSize(d); textArea.setSize(d); d.height = Math.min(d.height, maxWindowH); textArea.setPreferredSize(d);
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; }
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; }
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); }
JEditorPane jEditorPane = new JEditorPane(); jEditorPane.setEditable(false); jEditorPane.setContentType("text/html"); jEditorPane.setText(toolTipText); jEditorPane.setPreferredSize(new Dimension(800, 600));
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); }
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; }
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()); } }); }
/** 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); } }
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; }
/** * 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; }
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
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); }
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); }
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); }