本文整理汇总了Java中javafx.scene.AccessibleRole类的典型用法代码示例。如果您正苦于以下问题:Java AccessibleRole类的具体用法?Java AccessibleRole怎么用?Java AccessibleRole使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AccessibleRole类属于javafx.scene包,在下文中一共展示了AccessibleRole类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: IndicatorButton
import javafx.scene.AccessibleRole; //导入依赖的package包/类
public IndicatorButton(int pageNumber) {
this.pageNumber = pageNumber;
setFocusTraversable(false);
setIndicatorType();
setTooltipVisible(isTooltipVisible());
getSkinnable().getStyleClass().addListener(updateSkinIndicatorType);
setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
int selected = getCurrentPageIndex();
// We do not need to update the selection if it has not changed.
if (selected != IndicatorButton.this.pageNumber) {
pagination.setCurrentPageIndex(IndicatorButton.this.pageNumber);
requestLayout();
}
}
});
tooltipVisibleProperty().addListener(updateTooltipVisibility);
prefHeightProperty().bind(minHeightProperty());
setAccessibleRole(AccessibleRole.PAGE_ITEM);
}
示例2: CodeEditor
import javafx.scene.AccessibleRole; //导入依赖的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);
}
示例3: BasicEntityEditorSkin
import javafx.scene.AccessibleRole; //导入依赖的package包/类
public BasicEntityEditorSkin(BasicEntityEditor<T> control) {
super(control);
this.control = control;
this.control.showPopupProperty().addListener((v, o, n) -> {
if (n) showPopup(); else hidePopup();
});
this.control.valueProperty().addListener(this::updateTextField);
this.control.converterProperty().addListener(this::updateTextField);
if (control.showPopupProperty().get()) showPopup(); else hidePopup();
textField.textProperty().addListener(textInput);
//textField.setManaged(false);
textField.setEditable(true);
valueField.setMouseTransparent(true);
// As long as the screen-reader is concerned this node is not a list item.
// This matters because the screen-reader counts the number of list item
// within combo and speaks it to the user.
valueField.setAccessibleRole(AccessibleRole.NODE);
valueField.setAlignment(Pos.BASELINE_LEFT);
valueField.setMaxWidth(Integer.MAX_VALUE);
HBox.setHgrow(valueField, Priority.ALWAYS);
valueField.textProperty().bind(Bindings.createObjectBinding(()-> {
StringConverter<T> conv = control.converter.get();
return conv.toString(control.getValue());
}, control.converter, control.value));
control.setOnKeyReleased(e -> {
if (e.getCode() == KeyCode.DOWN) {
showPopup();
}
else if (e.getCode() == KeyCode.F7) {
if (e.isControlDown()) {
hidePopup();
control.editValue();
}
else {
hidePopup();
control.viewValue();
}
}
});
arrowButton.getStyleClass().addAll("arrow-button");
valueField.visibleProperty().bind(control.showPopupProperty().not());
textField.visibleProperty().bind(control.showPopupProperty());
HBox hbox = new HBox();
hbox.getStyleClass().remove("hbox");
hbox.setOnMouseClicked(e -> onArrowClicked());
hbox.setAlignment(Pos.BASELINE_LEFT);
valueField.setStyle("-fx-padding: 0.5em 0.8ex");
StackPane sp = new StackPane(valueField, textField);
//HBox.setHgrow(valueField, Priority.ALWAYS);
//HBox.setHgrow(textField, Priority.ALWAYS);
HBox.setHgrow(sp, Priority.ALWAYS);
HBox.setHgrow(arrowButton, Priority.NEVER);
HBox.setMargin(arrowButton, new Insets(5));
hbox.getChildren().addAll(sp, arrowButton);
getChildren().add(hbox);
}
示例4: initialize
import javafx.scene.AccessibleRole; //导入依赖的package包/类
private void initialize() {
getStyleClass().add(DEFAULT_STYLE_CLASS);
setAccessibleRole(AccessibleRole.DATE_PICKER);
setEditable(true);
}