本文整理汇总了Java中javafx.scene.web.WebView.setContextMenuEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java WebView.setContextMenuEnabled方法的具体用法?Java WebView.setContextMenuEnabled怎么用?Java WebView.setContextMenuEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.web.WebView
的用法示例。
在下文中一共展示了WebView.setContextMenuEnabled方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: UARTPanel
import javafx.scene.web.WebView; //导入方法依赖的package包/类
public UARTPanel()
{
WebView view = new WebView();
view.setContextMenuEnabled(false);
webEngine = view.getEngine();
messageQueue = new LinkedList<>();
valueDisplayOptions = new LinkedHashMap<>();
populateDisplayOptions();
ObservableValue<State> property = webEngine.getLoadWorker().stateProperty();
OnLoadListener.register(this::onLoad, property);
String content = "<html><head></head><body " + styleString() + "></body></html>";
webEngine.loadContent(content);
HBox controlPane = createControlPane();
this.setCenter(view);
this.setBottom(controlPane);
}
示例2: ConsolePane
import javafx.scene.web.WebView; //导入方法依赖的package包/类
public ConsolePane()
{
WebView view = new WebView();
view.setContextMenuEnabled(false);
webEngine = view.getEngine();
messageQueue = new LinkedList<>();
ObservableValue<State> property = webEngine.getLoadWorker().stateProperty();
OnLoadListener.register(this::onLoad, property);
String content = "<html><head></head><body></body></html>";
webEngine.loadContent(content);
ConsolePaneEventHandler eventHandler = new ConsolePaneEventHandler();
EventRegistry.getGlobalRegistry().register(eventHandler);
this.setCenter(view);
}
示例3: createView
import javafx.scene.web.WebView; //导入方法依赖的package包/类
private void createView() {
webView = new WebView();
webView.setContextMenuEnabled(false);
webEngine = webView.getEngine();
webEngine.documentProperty().addListener(new ChangeListener<Document>() {
@Override
public void changed(ObservableValue<? extends Document> prop, Document oldDoc, Document newDoc) {
logger.debug("WebView loaded dataviewer with id : [{}]", udID);
if (enableFireBug)
enableFirebug(webEngine);
}
});
String urlToLoad = getUrlToLoad() + udID;
logger.debug("Loading: [{}]", urlToLoad);
webEngine.load(urlToLoad);
setStyle("-fx-background-color: white;");
setCenter(webView);
setTop(topMenu = new TopMenu(plotData, latestConfig, this));
}
示例4: getWebView
import javafx.scene.web.WebView; //导入方法依赖的package包/类
protected WebView getWebView() {
if (engine == null) {
webView = new WebView();
webView.setContextMenuEnabled(false);
engine = webView.getEngine();
}
return webView;
}
示例5: Editor
import javafx.scene.web.WebView; //导入方法依赖的package包/类
public Editor() {
WebView view = new WebView();
view.setFontSmoothingType(FontSmoothingType.GRAY); // looks better than colored (LCD) blurring IMO
// caching with SPEED hint is awful on Linux and or low power machines (see issue #24)
// caching with QUALITY hint is indistinguishable from no caching as far as I can tell
// to to remove potential problems it's probably not worth enabling caching at all
view.setCache(false);
pageLoaded = false;
bridge = new Bridge(this);
engine = view.getEngine();
engine.setJavaScriptEnabled(true);
// these error messages seem useless because they only warn about re-using web cache directories
// which means that opening multiple instances of Simulizer gives error messages because both are trying to access
// ~/.simulizer.GuiMode$App and ~/.simulizer.Simulizer
//engine.setOnError((errorEvent) -> UIUtils.showErrorDialog("Editor JS Error", errorEvent.toString()));
// making it so calling alert() from javascript outputs to the console
engine.setOnAlert((event) -> System.out.println("javascript alert: " + event.getData()));
mode = Mode.EDIT_MODE;
// javascript does not have access to the outside clipboard
view.setContextMenuEnabled(false);
// handle copy and paste and other key-combinations manually
getEventManager().addEventFilter(KeyEvent.KEY_PRESSED, this::handleKeyEvent);
getContentPane().getChildren().add(view);
}
示例6: CodeEditor
import javafx.scene.web.WebView; //导入方法依赖的package包/类
public CodeEditor()
{
webView = new WebView();
aceEditor = new AceEditor();
codeBodyProperty = aceEditor.getBodyProperty();
acePageContentsProperty = aceEditor.getPage();
initializeEngineEvents();
webView.getEngine().loadContent(aceEditor.getPage().get());
// Add interface to access Java model from Javascript
JSObject jsObject = (JSObject) webView.getEngine().executeScript("window");
jsObject.setMember("javaContentModel", this);
acePageContentsProperty.addListener((observable, old, newValue) ->
{
System.out.println("Loaded:\n" + newValue);
webView.getEngine().loadContent(newValue);
});
codeBodyProperty.addListener(
(observable, old, newValue) -> System.out.println("CodeProperty changed"));
webView.setContextMenuEnabled(false);
//TODO create custom context menu (right click menu)
// TODO: move this to a js file
aceEditor.addCustomJavascriptRoutine(() -> "editor.on(\"change\", function() {"
+ "javaContentModel.updateTextFromJavascript(editor.getValue());"
+ "});");
setOnKeyReleased(event -> {
System.out.println("key released");
getBreakPoints();
});
setCenter(webView);
this.accessibleRoleProperty().set(AccessibleRole.TEXT_AREA);
}