Java Code Examples for javax.swing.JEditorPane#addPropertyChangeListener()
The following examples show how to use
javax.swing.JEditorPane#addPropertyChangeListener() .
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: GHelpHTMLEditorKit.java From ghidra with Apache License 2.0 | 6 votes |
@Override public void install(JEditorPane c) { super.install(c); delegateListeners = c.getHyperlinkListeners(); for (HyperlinkListener listener : delegateListeners) { c.removeHyperlinkListener(listener); } resolverHyperlinkListener = new ResolverHyperlinkListener(); c.addHyperlinkListener(resolverHyperlinkListener); // add a listener to report trace information c.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { String propertyName = evt.getPropertyName(); if ("page".equals(propertyName)) { Msg.trace(this, "Page loaded: " + evt.getNewValue()); } } }); }
Example 2
Source File: LineNumberBorder.java From nextreports-designer with Apache License 2.0 | 6 votes |
/** * Constructs a new <code>LineNumberBorder</code>. * * @param scrollPane The scroll pane using this border as the viewport * border. * @param editorPane The text component for which line numbers will be * displayed. * @param numberColor The color to use for the line numbers. If * <code>null</code>, a default is used. */ public LineNumberBorder(JScrollPane scrollPane, JEditorPane editorPane, Color numberColor) { this.editorPane = editorPane; this.scrollPane = scrollPane; setForeground(numberColor != null ? numberColor : DEFAULT_FOREGROUND); Color bg = editorPane.getBackground(); setBackground(bg == null ? Color.WHITE : bg); editorPane.addCaretListener(this); editorPane.addPropertyChangeListener(this); scrollPane.getViewport().addChangeListener(this); editorPane.getDocument().addDocumentListener(this); currentLine = 1; setFont(null); // default font. insets = new Insets(0, 0, 0, 0); updateCellHeights(); updateCellWidths(); }
Example 3
Source File: HTMLPrintable.java From ramus with GNU General Public License v3.0 | 6 votes |
public void loadPage(String url, final ActionListener listener) throws IOException { this.url = url; pane = new JEditorPane(); pane.setContentType("text/html"); pane.addPropertyChangeListener("page", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { generate(0); if (listener != null) listener.actionPerformed(new ActionEvent( HTMLPrintable.this, 0, "PageLoaded")); } }); pane.setPage(url); }
Example 4
Source File: StyledEditorKit.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Called when the kit is being installed into * a JEditorPane. * * @param c the JEditorPane */ public void install(JEditorPane c) { c.addCaretListener(inputAttributeUpdater); c.addPropertyChangeListener(inputAttributeUpdater); Caret caret = c.getCaret(); if (caret != null) { inputAttributeUpdater.updateInputAttributes (caret.getDot(), caret.getMark(), c); } }
Example 5
Source File: StyledEditorKit.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Called when the kit is being installed into * a JEditorPane. * * @param c the JEditorPane */ public void install(JEditorPane c) { c.addCaretListener(inputAttributeUpdater); c.addPropertyChangeListener(inputAttributeUpdater); Caret caret = c.getCaret(); if (caret != null) { inputAttributeUpdater.updateInputAttributes (caret.getDot(), caret.getMark(), c); } }
Example 6
Source File: StyledEditorKit.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Called when the kit is being installed into * a JEditorPane. * * @param c the JEditorPane */ public void install(JEditorPane c) { c.addCaretListener(inputAttributeUpdater); c.addPropertyChangeListener(inputAttributeUpdater); Caret caret = c.getCaret(); if (caret != null) { inputAttributeUpdater.updateInputAttributes (caret.getDot(), caret.getMark(), c); } }
Example 7
Source File: StyledEditorKit.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Called when the kit is being installed into * a JEditorPane. * * @param c the JEditorPane */ public void install(JEditorPane c) { c.addCaretListener(inputAttributeUpdater); c.addPropertyChangeListener(inputAttributeUpdater); Caret caret = c.getCaret(); if (caret != null) { inputAttributeUpdater.updateInputAttributes (caret.getDot(), caret.getMark(), c); } }
Example 8
Source File: StyledEditorKit.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Called when the kit is being installed into * a JEditorPane. * * @param c the JEditorPane */ public void install(JEditorPane c) { c.addCaretListener(inputAttributeUpdater); c.addPropertyChangeListener(inputAttributeUpdater); Caret caret = c.getCaret(); if (caret != null) { inputAttributeUpdater.updateInputAttributes (caret.getDot(), caret.getMark(), c); } }
Example 9
Source File: StyledEditorKit.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Called when the kit is being installed into * a JEditorPane. * * @param c the JEditorPane */ public void install(JEditorPane c) { c.addCaretListener(inputAttributeUpdater); c.addPropertyChangeListener(inputAttributeUpdater); Caret caret = c.getCaret(); if (caret != null) { inputAttributeUpdater.updateInputAttributes (caret.getDot(), caret.getMark(), c); } }
Example 10
Source File: StyledEditorKit.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Called when the kit is being installed into * a JEditorPane. * * @param c the JEditorPane */ public void install(JEditorPane c) { c.addCaretListener(inputAttributeUpdater); c.addPropertyChangeListener(inputAttributeUpdater); Caret caret = c.getCaret(); if (caret != null) { inputAttributeUpdater.updateInputAttributes (caret.getDot(), caret.getMark(), c); } }
Example 11
Source File: StyledEditorKit.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Called when the kit is being installed into * a JEditorPane. * * @param c the JEditorPane */ public void install(JEditorPane c) { c.addCaretListener(inputAttributeUpdater); c.addPropertyChangeListener(inputAttributeUpdater); Caret caret = c.getCaret(); if (caret != null) { inputAttributeUpdater.updateInputAttributes (caret.getDot(), caret.getMark(), c); } }
Example 12
Source File: StyledEditorKit.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Called when the kit is being installed into * a JEditorPane. * * @param c the JEditorPane */ public void install(JEditorPane c) { c.addCaretListener(inputAttributeUpdater); c.addPropertyChangeListener(inputAttributeUpdater); Caret caret = c.getCaret(); if (caret != null) { inputAttributeUpdater.updateInputAttributes (caret.getDot(), caret.getMark(), c); } }
Example 13
Source File: ActionFactory.java From netbeans with Apache License 2.0 | 5 votes |
void setPane(JEditorPane pane) { JEditorPane origPane = getPane(); if (origPane != null) { origPane.removePropertyChangeListener(this); origPane.getDocument().removeDocumentListener(this); } assert (pane != null); this.paneRef = new WeakReference<>(pane); pane.addPropertyChangeListener(this); pane.getDocument().addDocumentListener(this); updateState(); }
Example 14
Source File: FoldingSideBar.java From netbeans with Apache License 2.0 | 5 votes |
public FoldingSideBar(JEditorPane textView, AbstractOutputPane outputPane) { this.textView = textView; this.lines = getLines(); textView.addPropertyChangeListener("document", //NOI18N new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { FoldingSideBar.this.lines = getLines(); } }); textView.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { setPreferredSize(new Dimension(BAR_WIDTH, FoldingSideBar.this.textView.getHeight())); repaint(); } }); setMinimumSize(new Dimension(BAR_WIDTH, 0)); setPreferredSize(new Dimension(BAR_WIDTH, textView.getHeight())); setMaximumSize(new Dimension(BAR_WIDTH, Integer.MAX_VALUE)); wrapped = outputPane.isWrapped(); addMouseListener(new FoldingMouseListener()); addMouseMotionListener(new FoldingMouseListener()); //TODO one is enough }
Example 15
Source File: StyledEditorKit.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Called when the kit is being installed into * a JEditorPane. * * @param c the JEditorPane */ public void install(JEditorPane c) { c.addCaretListener(inputAttributeUpdater); c.addPropertyChangeListener(inputAttributeUpdater); Caret caret = c.getCaret(); if (caret != null) { inputAttributeUpdater.updateInputAttributes (caret.getDot(), caret.getMark(), c); } }
Example 16
Source File: StyledEditorKit.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Called when the kit is being installed into * a JEditorPane. * * @param c the JEditorPane */ public void install(JEditorPane c) { c.addCaretListener(inputAttributeUpdater); c.addPropertyChangeListener(inputAttributeUpdater); Caret caret = c.getCaret(); if (caret != null) { inputAttributeUpdater.updateInputAttributes (caret.getDot(), caret.getMark(), c); } }
Example 17
Source File: StyledEditorKit.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Called when the kit is being installed into * a JEditorPane. * * @param c the JEditorPane */ public void install(JEditorPane c) { c.addCaretListener(inputAttributeUpdater); c.addPropertyChangeListener(inputAttributeUpdater); Caret caret = c.getCaret(); if (caret != null) { inputAttributeUpdater.updateInputAttributes (caret.getDot(), caret.getMark(), c); } }
Example 18
Source File: StyledEditorKit.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Called when the kit is being installed into * a JEditorPane. * * @param c the JEditorPane */ public void install(JEditorPane c) { c.addCaretListener(inputAttributeUpdater); c.addPropertyChangeListener(inputAttributeUpdater); Caret caret = c.getCaret(); if (caret != null) { inputAttributeUpdater.updateInputAttributes (caret.getDot(), caret.getMark(), c); } }
Example 19
Source File: StyledEditorKit.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * Called when the kit is being installed into * a JEditorPane. * * @param c the JEditorPane */ public void install(JEditorPane c) { c.addCaretListener(inputAttributeUpdater); c.addPropertyChangeListener(inputAttributeUpdater); Caret caret = c.getCaret(); if (caret != null) { inputAttributeUpdater.updateInputAttributes (caret.getDot(), caret.getMark(), c); } }
Example 20
Source File: UpdateProgressBar.java From stendhal with GNU General Public License v2.0 | 4 votes |
private void initializeComponents() { JPanel contentPane = (JPanel) this.getContentPane(); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS)); contentPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); if (fromVersion == null) { contentPane.add(new JLabel("Please wait while " + ClientGameConfiguration.get("GAME_NAME") + " is downloaded...")); } else { contentPane.add(new JLabel("Downloading updates...")); } contentPane.add(Box.createVerticalStrut(5)); progressBar = new JProgressBar(0, max); progressBar.setStringPainted(false); progressBar.setValue(0); contentPane.add(progressBar); contentPane.add(Box.createVerticalStrut(5)); if (urlBase != null) { // Set up page display. browser = new JEditorPane(); browser.setContentType("text/html"); browser.setEditable(false); Dimension dim = new Dimension(600, 440); browser.setPreferredSize(dim); browser.addPropertyChangeListener("page", new UpdateProgressBarMetaRefreshSupport()); browser.addHyperlinkListener(new UpdateProgressBarHyperLinkListener()); Dimension windowSize = new Dimension(640, 480); setPreferredSize(windowSize); // TODO: load page async? try { browser.setPage(urlBase + fromVersion + "/" + toVersion + ".html"); } catch (IOException e) { System.out.println(e); } // Gige the page scroll bars if it needs them final JScrollPane scrollPane = new JScrollPane(browser); contentPane.add(scrollPane); } }