Class AbstractHtmlPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
FxHtmlPanel, SwingHtmlPanel

public abstract class AbstractHtmlPanel extends JPanel
Skeleton implementation for a panel that can display navigable HTML. The currently displayed location can be monitored using the "url" property.
Since:
17 Jul 2019
Author:
Mark Taylor
See Also:
  • Constructor Details

    • AbstractHtmlPanel

      protected AbstractHtmlPanel()
      Constructor.
  • Method Details

    • setUrl

      public abstract void setUrl(URL url)
      Sets the location which is to be displayed in this panel.
      Parameters:
      url - locator of resource to display
    • getUrl

      public abstract URL getUrl()
      Returns the location which is currently displayed in this panel.
      Returns:
      locator of displayed resource
    • hasJavaFx

      public static boolean hasJavaFx()
      Indicates whether the JRE has access to JavaFX classes, and hence whether the createFxPanel method ought to work.
      Returns:
      true iff createFxPanel ought to work
    • createFxPanel

      public static AbstractHtmlPanel createFxPanel()
      Attempts to create an HtmlPanel based on JavaFX classes. If it fails (for example because JavaFX classes are not present), null is returned and a report may be made through the loggint system.
      Returns:
      JavaFX-based instance, or null
    • createSwingPanel

      public static AbstractHtmlPanel createSwingPanel()
      Creates an HtmlPanel based on Swing classes. This should always work.
      Returns:
      Swing-based instance
    • createPanel

      public static AbstractHtmlPanel createPanel()
      Returns a best-efforts HtmlPanel.
      Returns:
      instance based on JavaFX if possible, otherwise instance based on Swing