Java Code Examples for javax.swing.JEditorPane#setMargin()
The following examples show how to use
javax.swing.JEditorPane#setMargin() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AboutDialogFactory.java From lucene-solr with Apache License 2.0 | 6 votes |
private JScrollPane center() { JEditorPane editorPane = new JEditorPane(); editorPane.setOpaque(false); editorPane.setMargin(new Insets(0, 5, 2, 5)); editorPane.setContentType("text/html"); editorPane.setText(LICENSE_NOTICE); editorPane.setEditable(false); editorPane.addHyperlinkListener(hyperlinkListener); JScrollPane scrollPane = new JScrollPane(editorPane, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setBorder(BorderFactory.createLineBorder(Color.gray)); SwingUtilities.invokeLater(() -> { // Set the scroll bar position to top scrollPane.getVerticalScrollBar().setValue(0); }); return scrollPane; }
Example 2
Source File: RubyConsole.java From ramus with GNU General Public License v3.0 | 5 votes |
public JComponent createComponent() { JPanel panel = new JPanel(); JPanel console = new JPanel(); panel.setLayout(new BorderLayout()); final JEditorPane text = new JTextPane(); text.setMargin(new Insets(8, 8, 8, 8)); text.setCaretColor(new Color(0xa4, 0x00, 0x00)); text.setBackground(new Color(0xf2, 0xf2, 0xf2)); text.setForeground(new Color(0xa4, 0x00, 0x00)); Font font = findFont("Monospaced", Font.PLAIN, 14, new String[]{ "Monaco", "Andale Mono"}); text.setFont(font); JScrollPane pane = new JScrollPane(); pane.setViewportView(text); pane.setBorder(BorderFactory.createLineBorder(Color.darkGray)); panel.add(pane, BorderLayout.CENTER); console.validate(); final TextAreaReadline tar = new TextAreaReadline(text, getString("Wellcom") + " \n\n"); RubyInstanceConfig config = new RubyInstanceConfig() { { //setInput(tar.getInputStream()); //setOutput(new PrintStream(tar.getOutputStream())); //setError(new PrintStream(tar.getOutputStream())); setObjectSpaceEnabled(false); } }; Ruby runtime = Ruby.newInstance(config); tar.hookIntoRuntimeWithStreams(runtime); run(runtime); return panel; }
Example 3
Source File: DemoPanel.java From littleluck with Apache License 2.0 | 5 votes |
private static JComponent createDescriptionArea(URL descriptionURL) { JEditorPane descriptionPane = new HTMLPanel(); descriptionPane.setEditable(false); descriptionPane.setMargin(margin); descriptionPane.setOpaque(true); try { descriptionPane.setPage(descriptionURL); } catch (IOException e) { System.err.println("couldn't load description from URL:" + descriptionURL); } return descriptionPane; }
Example 4
Source File: DemoPanel.java From beautyeye with Apache License 2.0 | 5 votes |
private static JComponent createDescriptionArea(URL descriptionURL) { JEditorPane descriptionPane = new HTMLPanel(); descriptionPane.setEditable(false); descriptionPane.setMargin(margin); descriptionPane.setOpaque(true); try { descriptionPane.setPage(descriptionURL); } catch (IOException e) { System.err.println("couldn't load description from URL:" + descriptionURL); } return descriptionPane; }
Example 5
Source File: HTMLHelper.java From javamoney-examples with Apache License 2.0 | 5 votes |
/** * This method creates and returns an editor pane for displaying HTML * formatted text. * * @return An editor pane for displaying HTML formatted text. */ public static JEditorPane createWebPage() { JEditorPane pane = new JEditorPane("text/html", ""); pane.setEditable(false); pane.setMargin(new Insets(0, 0, 0, 0)); return pane; }
Example 6
Source File: TutorialBrowser.java From rapidminer-studio with GNU Affero General Public License v3.0 | 4 votes |
private Component createContentPanel() { contentGbc = new GridBagConstraints(); contentPanel = new JPanel(new GridBagLayout()) { @Override public Dimension getPreferredSize() { return new Dimension(getParent().getWidth(), super.getPreferredSize().height); } }; contentPanel.setBackground(Colors.WHITE); jEditorPane = new JEditorPane() { @Override public Dimension getPreferredSize() { return new Dimension(getParent().getWidth(), super.getPreferredSize().height); } }; jEditorPane.setEditable(false); contentGbc.gridx = 0; contentGbc.gridy = 0; contentGbc.weightx = 1.0f; contentGbc.fill = GridBagConstraints.HORIZONTAL; contentPanel.add(jEditorPane, contentGbc); // add filler at bottom contentGbc.gridy += 1; contentGbc.weighty = 1.0f; contentGbc.fill = GridBagConstraints.BOTH; contentPanel.add(new JLabel(), contentGbc); // prepare contentGbc for feedback form contentGbc.gridy += 1; contentGbc.weighty = 0.0f; contentGbc.fill = GridBagConstraints.HORIZONTAL; scrollPane = new ExtendedJScrollPane(contentPanel); scrollPane.setBorder(null); HTMLEditorKit kit = new HTMLEditorKit(); jEditorPane.setEditorKit(kit); jEditorPane.setMargin(new Insets(0, 0, 0, 0)); Document doc = kit.createDefaultDocument(); jEditorPane.setDocument(doc); jEditorPane.setText(String.format(INFO_TEMPLATE, NO_TUTORIAL_SELECTED)); jEditorPane.addHyperlinkListener(e -> { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { ActionStatisticsCollector.INSTANCE.log(ActionStatisticsCollector.TYPE_GETTING_STARTED, TUTORIAL_BROWSER_DOCK_KEY, "open_remote_url"); RMUrlHandler.handleUrl(e.getURL().toString()); } }); return scrollPane; }