javax.swing.JEditorPane#addPropertyChangeListener ( )源码实例Demo

下面列出了javax.swing.JEditorPane#addPropertyChangeListener ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: ghidra   文件: GHelpHTMLEditorKit.java
@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());
			}
		}
	});
}
 
源代码2 项目: ramus   文件: HTMLPrintable.java
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);
}
 
源代码3 项目: nextreports-designer   文件: LineNumberBorder.java
/**
 * 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();
}
 
源代码4 项目: jdk1.8-source-analysis   文件: StyledEditorKit.java
/**
 * 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);
    }
}
 
源代码5 项目: jdk8u-dev-jdk   文件: StyledEditorKit.java
/**
 * 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);
    }
}
 
源代码6 项目: TencentKona-8   文件: StyledEditorKit.java
/**
 * 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);
    }
}
 
源代码7 项目: jdk8u60   文件: StyledEditorKit.java
/**
 * 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);
    }
}
 
源代码8 项目: JDKSourceCode1.8   文件: StyledEditorKit.java
/**
 * 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);
    }
}
 
源代码9 项目: openjdk-jdk8u   文件: StyledEditorKit.java
/**
 * 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);
    }
}
 
源代码10 项目: netbeans   文件: FoldingSideBar.java
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
}
 
源代码11 项目: netbeans   文件: ActionFactory.java
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();
}
 
源代码12 项目: openjdk-jdk8u-backup   文件: StyledEditorKit.java
/**
 * 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);
    }
}
 
源代码13 项目: Bytecoder   文件: StyledEditorKit.java
/**
 * 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);
    }
}
 
源代码14 项目: openjdk-jdk9   文件: StyledEditorKit.java
/**
 * 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);
    }
}
 
源代码15 项目: jdk8u-jdk   文件: StyledEditorKit.java
/**
 * 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);
    }
}
 
源代码16 项目: jdk8u-jdk   文件: StyledEditorKit.java
/**
 * 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);
    }
}
 
源代码17 项目: openjdk-8-source   文件: StyledEditorKit.java
/**
 * 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);
    }
}
 
源代码18 项目: openjdk-8   文件: StyledEditorKit.java
/**
 * 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);
    }
}
 
源代码19 项目: jdk8u_jdk   文件: StyledEditorKit.java
/**
 * 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);
    }
}
 
源代码20 项目: stendhal   文件: UpdateProgressBar.java
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);
	}
}