Class BrowserComponent

All Implemented Interfaces:
DynamicPropertyProvider, LocaleListener, MutableDynamicPropertyProvider, StyleProvider, ComponentLifecycle, ExtensibleComponent, QualityMonitor, VisionComponent, ImageObserver, MenuContainer, Serializable, Accessible

public class BrowserComponent extends AbstractVisionPanel implements LocaleListener, ExtensibleComponent
See Also:
  • Field Details

  • Constructor Details

    • BrowserComponent

      public BrowserComponent()
  • Method Details

    • initBrowser

      protected void initBrowser()
      Does the initialization for the JxBrowser browser. May be called multiple times during the lifecycle of the web browser component, because some changes in settings may require closing of the old browser and creating a new one.

      Engine should only be null if no supported OS was detected. In that case, we'll have added a UNSUPPORTED_OS_LABEL which will get displayed. The nullness of browserContext won't change while the client is open.

    • getHttpServerPair

      protected String getHttpServerPair()
    • getHttpsServerPair

      protected String getHttpsServerPair()
    • getFtpServerPair

      protected String getFtpServerPair()
    • getSocksServerPair

      protected String getSocksServerPair()
    • onStartup

      protected void onStartup()
      Description copied from class: AbstractVisionPanel
      Subclasses should override this to provide startup logic.
      Overrides:
      onStartup in class AbstractVisionPanel
    • onShutdown

      protected void onShutdown()
      Description copied from class: AbstractVisionPanel
      Subclasses should override this to provide shutdown logic.
      Overrides:
      onShutdown in class AbstractVisionPanel
    • getBrowser

      public com.teamdev.jxbrowser.browser.Browser getBrowser()
      Gets the browser object so advanced users can have at the browser's api. In previous versions of this module, the Browser object was a JComponent that provided component interaction features. Since module version 4.0.0, this object is now only a reference to the internal browser object, which is wrapped in a BrowserView component for display purposes. If trying access to the BrowserView JComponent, call getBrowserView().

      Note that the Browser may be in a 'closed' state, and must be checked for this state before using.

      Returns:
      the instance of the Browser
      Since:
      4.0.0
    • getBrowserView

      @Nullable public com.teamdev.jxbrowser.view.swing.BrowserView getBrowserView()
      Returns the JComponent that that Browser is held within.
      Returns:
      the BrowserView component.
      Since:
      WebBrowser Module version 4.0.0
    • setStartingUrl

      public void setStartingUrl(String url)
    • getStartingUrl

      public String getStartingUrl()
    • setStartingHtml

      public void setStartingHtml(String html)
    • getStartingHtml

      public String getStartingHtml()
    • setTitle

      public void setTitle(String title)
    • getTitle

      public String getTitle()
    • setCurrentUrl

      public void setCurrentUrl()
    • setCurrentUrl

      public void setCurrentUrl(String currentUrl)
    • getComponentEnabled

      public boolean getComponentEnabled()
    • setComponentEnabled

      public void setComponentEnabled(boolean componentEnabled)
    • enableComponent

      public void enableComponent()
    • getCurrentUrl

      public String getCurrentUrl()
    • setCurrentHtml

      public void setCurrentHtml()
    • setCurrentHtml

      public void setCurrentHtml(String notUsed)
    • getCurrentHtml

      public String getCurrentHtml()
    • setIsLoaded

      public void setIsLoaded(boolean isLoaded)
    • getIsLoaded

      public boolean getIsLoaded()
    • getMode

      public int getMode()
    • setMode

      public void setMode(int mode)
    • setShowNavigation

      public void setShowNavigation(boolean showNavigation)
    • isShowNavigation

      public boolean isShowNavigation()
    • setPopupsAllowed

      public void setPopupsAllowed(boolean popupsAllowed)
    • getPopupsAllowed

      public boolean getPopupsAllowed()
    • setZoomLevel

      public void setZoomLevel(double zoomLevel)
    • getZoomLevel

      public double getZoomLevel()
    • setUseProxies

      public void setUseProxies(boolean useProxies)
    • getUseProxies

      public boolean getUseProxies()
    • setHttpProxyServer

      public void setHttpProxyServer(String httpProxyServer)
    • getHttpProxyServer

      public String getHttpProxyServer()
    • setHttpsProxyServer

      public void setHttpsProxyServer(String httpsProxyServer)
    • getHttpsProxyServer

      public String getHttpsProxyServer()
    • setFtpProxyServer

      public void setFtpProxyServer(String ftpProxyServer)
    • getFtpProxyServer

      public String getFtpProxyServer()
    • setProxyExceptions

      public void setProxyExceptions(String proxyExceptions)
    • getProxyExceptions

      public String getProxyExceptions()
    • setHttpProxyPort

      public void setHttpProxyPort(int httpProxyPort)
    • getHttpProxyPort

      public int getHttpProxyPort()
    • setHttpsProxyPort

      public void setHttpsProxyPort(int httpsProxyPort)
    • getHttpsProxyPort

      public int getHttpsProxyPort()
    • setFtpProxyPort

      public void setFtpProxyPort(int ftpProxyPort)
    • getSocksProxyServer

      public String getSocksProxyServer()
    • setSocksProxyServer

      public void setSocksProxyServer(String socksProxyServer)
    • getSocksProxyPort

      public int getSocksProxyPort()
    • setSocksProxyPort

      public void setSocksProxyPort(int socksProxyPort)
    • getFtpProxyPort

      public int getFtpProxyPort()
    • setUseProxyAuthentication

      public void setUseProxyAuthentication(boolean useAuthentication)
    • isUseProxyAuthentication

      public boolean isUseProxyAuthentication()
    • setProxyUsername

      public void setProxyUsername(String proxyUsername)
    • getProxyUsername

      public String getProxyUsername()
    • setProxyPassword

      public void setProxyPassword(String proxyPassword)
    • getProxyPassword

      public String getProxyPassword()
    • getTouchscreenMode

      public int getTouchscreenMode()
    • setTouchscreenMode

      public void setTouchscreenMode(int touchscreenMode)
    • reloadStarting

      protected void reloadStarting()
    • reloadCurrent

      protected void reloadCurrent()
    • reload

      protected void reload(String url, String html)
    • loadUrl

      protected void loadUrl()
    • loadUrl

      protected void loadUrl(String url)
    • loadHtml

      protected void loadHtml()
    • loadHtml

      protected void loadHtml(String html)
    • stopLoading

      protected void stopLoading()
    • initPopupBehavior

      public void initPopupBehavior()
    • back

      public void back()
      If the browser is able to go back, it will, otherwise does nothing.
    • forward

      public void forward()
      If the browser is able to go forward, it will, otherwise does nothing.
    • refresh

      public void refresh()
      Reloads the existing browser object, or creates a new one. This allows reload to work even if the browser has crashed.
    • disposeAndInit

      protected void disposeAndInit()
    • executeJavaScript

      public void executeJavaScript(String javaScript)
      Tries to execute a script. Does not check to see if the script parses, is valid javascript, or will actually do anything useful
      Parameters:
      javaScript - String with JavaScript to execute.
    • getImage

      public byte[] getImage()
      Returns a byte array with a jpg of a screen shot of the current browser window.
    • newButton

      protected JButton newButton(Action action)
    • localeChanged

      public void localeChanged(Locale newLocale)
      Specified by:
      localeChanged in interface LocaleListener
      Overrides:
      localeChanged in class AbstractVisionPanel
    • getExtensionFunctions

      public Map<String,ExtensionFunction> getExtensionFunctions()
      Specified by:
      getExtensionFunctions in interface ExtensibleComponent
    • setExtensionFunctions

      public void setExtensionFunctions(Map<String,ExtensionFunction> map)
      Specified by:
      setExtensionFunctions in interface ExtensibleComponent