protected JXEditorPane createDefaultEditorPane() { final JXEditorPane editorPane = new JXEditorPane(); editorPane.setEditable(false); editorPane.setContentType("text/html"); return editorPane; }
private void init() { putClientProperty(HONOR_DISPLAY_PROPERTIES, true); setEditorKitForContentType("text/html", new SloppyHTMLEditorKit()); addPropertyChangeListener(new PropertyHandler()); getDocument().addUndoableEditListener(getUndoableEditListener()); initActions(); }
@Override public void itemStateChanged(ItemEvent evt) { if (evt.getStateChange() == ItemEvent.SELECTED) { applyTag((HTML.Tag)evt.getItem()); } }
CLASS_NAME + ".details_expand_text", errorMessage.getLocale())); details = new JXEditorPane(); details.setContentType("text/html"); details.putClientProperty(JXEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE); details.setTransferHandler(createDetailsTransferHandler(details)); detailsScrollPane = new JScrollPane(details); detailsScrollPane.setPreferredSize(new Dimension(10, 250)); details.setEditable(false); detailsPanel = new JPanel(); detailsPanel.setVisible(false);
ActionMap map = getActionMap(); map.remove(ACTION_CUT); cut(); map.put(ACTION_CUT, this); } else if (ACTION_COPY.equals(name)) { ActionMap map = getActionMap(); map.remove(ACTION_COPY); copy(); map.put(ACTION_COPY, this); } else if (ACTION_PASTE.equals(name)) { ActionMap map = getActionMap(); map.remove(ACTION_PASTE); paste(); map.put(ACTION_PASTE, this);
final JXEditorPane detailedMessagePane = new JXEditorPane("text/html", detailedMessage); detailedMessagePane.setEditable(false); detailedMessagePane.setOpaque(false); detailedMessagePane.addHyperlinkListener(event -> { if (HyperlinkEvent.EventType.ACTIVATED.equals(event.getEventType())) { final String href = event.getDescription(); detailedMessagePane.setBorder(new EmptyBorder(10, 10, 40, 10));
result = new DCPanel(); if (Version.isCommunityEdition()) { final JXEditorPane editorPane = new JXEditorPane("text/html", "You're now using the <i>Community Edition</i> of DataCleaner.<br/><br/>" + "We hope that you enjoy this free product. We encourage you to also check out the " + "helpful getting started wizards and commercial support. " + "You can find more information about them online."); editorPane.setEditable(false); editorPane.setOpaque(false); editorPane.setFont(WidgetUtils.FONT_HEADER2); editorPane.setPreferredSize(new Dimension(DCSplashPanel.WIDTH_CONTENT, adjuster.adjust(120)));
/** * Register the actions that this class can handle. */ protected void initActions() { ActionMap map = getActionMap(); map.put(ACTION_FIND, new Actions(ACTION_FIND)); map.put(ACTION_UNDO, new Actions(ACTION_UNDO)); map.put(ACTION_REDO, new Actions(ACTION_REDO)); map.put(ACTION_CUT, new Actions(ACTION_CUT)); map.put(ACTION_COPY, new Actions(ACTION_COPY)); map.put(ACTION_PASTE, new Actions(ACTION_PASTE)); KeyStroke findStroke = SearchFactory.getInstance().getSearchAccelerator(); getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(findStroke, "find"); }
/** * @param currentResult * @param offset * @return the start position of the selected text */ private int updateStateAfterFound(MatchResult currentResult, final int offset) { int end = currentResult.end() + offset; int found = currentResult.start() + offset; select(found, end); getCaret().setSelectionVisible(true); lastFoundIndex = found; lastMatchResult = currentResult; lastRegEx = ((Matcher) lastMatchResult).pattern().pattern(); return found; }
public EditorPaneLinkVisitor(JXEditorPane pane) { if (pane == null) { pane = createDefaultEditorPane(); } this.editorPane = pane; pane.addHyperlinkListener(getHyperlinkListener()); }
@Override public void actionPerformed(ActionEvent ae) { details.copy(); } };
/** * Overidden to perform document initialization based on type. */ @Override public void setEditorKit(EditorKit kit) { super.setEditorKit(kit); if (kit instanceof StyledEditorKit) { if (caretHandler == null) { caretHandler = new CaretHandler(); } addCaretListener(caretHandler); } }
CLASS_NAME + ".details_expand_text", errorMessage.getLocale())); details = new JXEditorPane(); details.setContentType("text/html"); details.putClientProperty(JXEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE); details.setTransferHandler(createDetailsTransferHandler(details)); detailsScrollPane = new JScrollPane(details); detailsScrollPane.setPreferredSize(new Dimension(10, 250)); details.setEditable(false); detailsPanel = new JPanel(); detailsPanel.setVisible(false);
ActionMap map = getActionMap(); map.remove(ACTION_CUT); cut(); map.put(ACTION_CUT, this); } else if (ACTION_COPY.equals(name)) { ActionMap map = getActionMap(); map.remove(ACTION_COPY); copy(); map.put(ACTION_COPY, this); } else if (ACTION_PASTE.equals(name)) { ActionMap map = getActionMap(); map.remove(ACTION_PASTE); paste(); map.put(ACTION_PASTE, this);
final File file = fileResource.getFile(); if (file != null && file.exists()) { final JXEditorPane editorPane = new JXEditorPane("text/html", "Data was written to file: <a href=\"https://datacleaner.org/open_file\">" + file .getAbsolutePath() + "</a>."); editorPane.setEditable(false); editorPane.setOpaque(false); editorPane.addHyperlinkListener(event -> { if (HyperlinkEvent.EventType.ACTIVATED.equals(event.getEventType())) { final String href = event.getDescription(); errorRowsPanel.add(icon, BorderLayout.WEST); final JXEditorPane editorPane = new JXEditorPane("text/html", "<b>" + result.getErrorRowCount() + " records</b> could <i>not</i> be written to the table!<br/>" + "The records were written to <a href=\"https://datacleaner.org/preview_datastore\">" + errorDatastore.getFilename() + "</a> (<a href=\"https://datacleaner.org/register_datastore\">Register as datastore</a>)."); editorPane.setEditable(false); editorPane.setOpaque(false); editorPane.addHyperlinkListener(e -> { if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) { final String href = e.getDescription();
/** * Register the actions that this class can handle. */ protected void initActions() { ActionMap map = getActionMap(); map.put(ACTION_FIND, new Actions(ACTION_FIND)); map.put(ACTION_UNDO, new Actions(ACTION_UNDO)); map.put(ACTION_REDO, new Actions(ACTION_REDO)); map.put(ACTION_CUT, new Actions(ACTION_CUT)); map.put(ACTION_COPY, new Actions(ACTION_COPY)); map.put(ACTION_PASTE, new Actions(ACTION_PASTE)); KeyStroke findStroke = SearchFactory.getInstance().getSearchAccelerator(); getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(findStroke, "find"); }
/** * @param currentResult * @param offset * @return the start position of the selected text */ private int updateStateAfterFound(MatchResult currentResult, final int offset) { int end = currentResult.end() + offset; int found = currentResult.start() + offset; select(found, end); getCaret().setSelectionVisible(true); lastFoundIndex = found; lastMatchResult = currentResult; lastRegEx = ((Matcher) lastMatchResult).pattern().pattern(); return found; }
public EditorPaneLinkVisitor(JXEditorPane pane) { if (pane == null) { pane = createDefaultEditorPane(); } this.editorPane = pane; pane.addHyperlinkListener(getHyperlinkListener()); }
@Override public void actionPerformed(ActionEvent ae) { details.copy(); } };
/** * Overidden to perform document initialization based on type. */ @Override public void setEditorKit(EditorKit kit) { super.setEditorKit(kit); if (kit instanceof StyledEditorKit) { if (caretHandler == null) { caretHandler = new CaretHandler(); } addCaretListener(caretHandler); } }