-
Bug
-
Resolution: Fixed
-
P4
-
1.4.0
-
tiger
-
x86
-
linux
Name: nt126004 Date: 08/15/2001
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)
JEditorPane normally fires a "page" property change when it has finished
loading a page asynchronously (from the constructor or setPage() method).
However, this does not happen when a page is loaded as a result of form
submission.
------ Example code: -------
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.net.URL;
import java.beans.*;
public class Foo extends JFrame
implements PropertyChangeListener, HyperlinkListener {
private JEditorPane browser;
public Foo() {
browser = new JEditorPane();
browser.setEditable(false);
browser.addPropertyChangeListener(this);
browser.addHyperlinkListener(this);
browser.setPreferredSize(new Dimension(600, 400));
getContentPane().add(browser);
pack();
setVisible(true);
}
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
gotoHref(e.getURL());
}
public void propertyChange(PropertyChangeEvent e) {
String name = e.getPropertyName();
if (name.equals("page")) {
//String value = (String) e.getNewValue();
System.out.println("page: " + e.getNewValue());
}
}
public void gotoHref(URL url) {
try {
browser.setPage(url);
} catch (Exception e) {}
}
public void gotoHref(String href) {
try {
browser.setPage(href);
} catch (Exception e) {}
}
static void main(String [] args) {
new Foo().gotoHref("http://www.google.com");
}
}
------ End example code: -------
1. Start the example code (java Foo).
Result: Google homepage appears in the window
Console output: page: http://www.google.com
2. Enter "bla" on the text line, press enter.
Result: A new page with a list of matches appears in the window, but no "page"
PropertyChange is fired.
3. Click on the first match ("Welcome to the bla-bla entertainment network!",
www.bla-bla.com)
Result: New page appears in the window, page PropertyChange is fired
Console output: page: www.bla-bla.com
(Review ID: 130088)
======================================================================
- relates to
-
JDK-6222200 REGRESSION: JEditorPane posts HTML content with post even using GET
- Resolved