public interface CefBrowser
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
canGoBack()
Tests if the browser can navigate backwards.
|
boolean |
canGoForward()
Tests if the browser can navigate forwards.
|
void |
close()
Close the browser.
|
void |
executeJavaScript(String code,
String url,
int line)
Execute a string of JavaScript code in this frame.
|
void |
find(int identifier,
String searchText,
boolean forward,
boolean matchCase,
boolean findNext)
Search for some kind of text on the page.
|
CefBrowser |
getDevTools()
Get an instance of the dev tools to be displayed in its own window or to be
embedded within your UI.
|
CefBrowser |
getDevTools(Point inspectAt)
Get an instance of the dev tools to be displayed in its own window or to be
embedded within your UI.
|
int |
getIdentifier()
Returns the unique browser identifier.
|
CefRenderHandler |
getRenderHandler()
Get an implementation of CefRenderHandler if any.
|
void |
getSource(CefStringVisitor visitor)
Retrieve this frame's HTML source as a string sent to the specified
visitor.
|
void |
getText(CefStringVisitor visitor)
Retrieve this frame's display text as a string sent to the specified
visitor.
|
Component |
getUIComponent()
Get the underlying UI component (e.g. java.awt.Canvas).
|
String |
getURL()
Emits the URL currently loaded in this frame.
|
CefWindowHandler |
getWindowHandler()
Get an implementation of CefWindowHandler if any.
|
double |
getZoomLevel()
Get the current zoom level.
|
void |
goBack()
Go back.
|
void |
goForward()
Go forward.
|
boolean |
hasDocument()
Tests if a document has been loaded in the browser.
|
boolean |
isLoading()
Tests if the browser is currently loading.
|
boolean |
isPopup()
Tests if the window is a popup window.
|
void |
loadRequest(CefRequest request)
Load the request represented by the request object.
|
void |
loadString(String val,
String url)
Load the contents of val with the specified dummy url.
|
void |
loadURL(String url)
Load the specified URL in the main frame.
|
void |
print()
Print the current browser contents.
|
void |
reload()
Reload the current page.
|
void |
reloadIgnoreCache()
Reload the current page ignoring any cached data.
|
void |
replaceMisspelling(String word)
If a misspelled word is currently selected in an editable node calling
this method will replace it with the specified |word|.
|
void |
runFileDialog(CefDialogHandler.FileDialogMode mode,
String title,
String defaultFilePath,
Vector<String> acceptFilters,
int selectedAcceptFilter,
CefRunFileDialogCallback callback)
Call to run a file chooser dialog.
|
void |
setFocus(boolean enable)
Set or remove keyboard focus to/from the browser window.
|
void |
setWindowVisibility(boolean visible)
Set whether the window containing the browser is visible
(minimized/unminimized, app hidden/unhidden, etc).
|
void |
setZoomLevel(double zoomLevel)
Change the zoom level to the specified value.
|
void |
startDownload(String url)
Download the file at url using CefDownloadHandler.
|
void |
stopFinding(boolean clearSelection)
Cancel all searches that are currently going on.
|
void |
stopLoad()
Stop loading the page.
|
void |
viewSource()
Save this frame's HTML source to a temporary file and open it in the
default text viewing application.
|
Component getUIComponent()
CefRenderHandler getRenderHandler()
CefWindowHandler getWindowHandler()
boolean canGoBack()
void goBack()
boolean canGoForward()
void goForward()
boolean isLoading()
void reload()
void reloadIgnoreCache()
void stopLoad()
int getIdentifier()
boolean isPopup()
boolean hasDocument()
void viewSource()
void getSource(CefStringVisitor visitor)
visitor - void getText(CefStringVisitor visitor)
visitor - void loadRequest(CefRequest request)
request - The request object.void loadURL(String url)
url - The URL to load.void loadString(String val, String url)
val - Content to be displayed.url - dummy url to be used for.void executeJavaScript(String code, String url, int line)
code - The code to be executed.url - The URL where the script in question can be found.line - The base line number to use for error reporting.String getURL()
void close()
void setFocus(boolean enable)
enable - set to true to give the focus to the browservoid setWindowVisibility(boolean visible)
visible - double getZoomLevel()
void setZoomLevel(double zoomLevel)
zoomLevel - The zoom level to be set.void runFileDialog(CefDialogHandler.FileDialogMode mode, String title, String defaultFilePath, Vector<String> acceptFilters, int selectedAcceptFilter, CefRunFileDialogCallback callback)
mode - represents the type of dialog to display.title - to be used for the dialog and may be empty to show the
default title ("Open" or "Save" depending on the mode).defaultFilePath - is the path with optional directory and/or file name
component that should be initially selected in the dialog.acceptFilters - are used to restrict the selectable file types and may
any combination of (a) valid lower-cased MIME types (e.g. "text/*" or
"image/*"), (b) individual file extensions (e.g. ".txt" or ".png"), or (c)
combined description and file extension delimited using "|" and ";" (e.g.
"Image Types|.png;.gif;.jpg").selectedAcceptFilter - is the 0-based index of the filter that should
be selected by default.callback - will be executed after the dialog is dismissed or
immediately if another dialog is already pending.void startDownload(String url)
url - URL to download that file.void print()
void find(int identifier,
String searchText,
boolean forward,
boolean matchCase,
boolean findNext)
identifier - can be used to have multiple searches running simultaniously.searchText - to be searched for.forward - indicates whether to search forward or backward within the page.matchCase - indicates whether the search should be case-sensitive.findNext - indicates whether this is the first request or a follow-up.void stopFinding(boolean clearSelection)
clearSelection - Set to true to reset selection.CefBrowser getDevTools()
CefBrowser getDevTools(Point inspectAt)
inspectAt - a position in the UI which should be inspected.void replaceMisspelling(String word)
word - replace selected word with this word.Copyright © 2017. All rights reserved.