Java源码示例:javafx.geometry.NodeOrientation
示例1
private TooltipBehavior(Duration hoverDelay, Duration visibleDuration, Duration leftDelay) {
setHoverDelay(hoverDelay);
hoverTimer.setOnFinished(event -> {
ensureHoveredNodeIsVisible(() -> {
// set tooltip orientation
NodeOrientation nodeOrientation = hoveredNode.getEffectiveNodeOrientation();
nextTooltip.getScene().setNodeOrientation(nodeOrientation);
//show tooltip
showTooltip(nextTooltip);
currentTooltip = nextTooltip;
hoveredNode = null;
// start visible timer
visibleTimer.playFromStart();
});
// clear next tooltip
nextTooltip = null;
});
setVisibleDuration(visibleDuration);
visibleTimer.setOnFinished(event -> hideCurrentTooltip());
setLeftDelay(leftDelay);
leftTimer.setOnFinished(event -> hideCurrentTooltip());
}
示例2
public void show(boolean showAgainChecked) {
if (dontShowAgainId == null || DontShowAgainLookup.showAgain(dontShowAgainId)) {
createGridPane();
if (LanguageUtil.isDefaultLanguageRTL())
getRootContainer().setNodeOrientation(NodeOrientation.RIGHT_TO_LEFT);
addHeadLine();
if (showBusyAnimation)
addBusyAnimation();
addMessage();
if (showReportErrorButtons)
addReportErrorButtons();
addButtons();
addDontShowAgainCheckBox(showAgainChecked);
applyStyles();
onShow();
}
}
示例3
private VBox filter(ObservableList<Button> nodes){
VBox vBox = new VBox();
vBox.getStyleClass().add("drawer-content");
vBox.setNodeOrientation(NodeOrientation.LEFT_TO_RIGHT);
vBox.setAlignment(Pos.TOP_RIGHT);
VBox.setVgrow(vBox, Priority.ALWAYS);
for (Button node : nodes){
if (node.getGraphic() != null) node.setContentDisplay(ContentDisplay.TEXT_ONLY);
node.setAlignment(Pos.CENTER_LEFT);
}
vBox.getChildren().setAll(nodes);
return vBox;
}
示例4
private void initToolBar() {
toolBar.setId("toolBar");
toolBar.getItems().addAll(clearButton, showMessageButton);
toolBar.setNodeOrientation(NodeOrientation.RIGHT_TO_LEFT);
resultPaneLayout.setTop(toolBar);
if (failuresList.isEmpty()) {
clearButton.setDisable(true);
}
clearButton.setOnAction(e -> clear());
showMessageButton.setDisable(true);
showMessageButton.setOnAction(e -> showMessage());
}
示例5
private void initComponents() {
toolBar.setId("toolBar");
toolBar.setNodeOrientation(NodeOrientation.RIGHT_TO_LEFT);
toolBar.getItems().addAll(clearButton, exportButton, wordWrapButton);
clearButton.setDisable(true);
exportButton.setDisable(true);
clearButton.setOnAction((e) -> clear());
exportButton.setOnAction(e -> onExport());
wordWrapButton.setOnAction((e) -> textArea.setWrapText(wordWrapButton.isSelected()));
content.setTop(toolBar);
content.setCenter(textArea);
}
示例6
public Clock(@NamedArg("skinType") final ClockSkinType skinType, @NamedArg("time") final ZonedDateTime time) {
setNodeOrientation(NodeOrientation.LEFT_TO_RIGHT);
this.skinType = skinType;
getStyleClass().add("clock");
init(time);
registerListeners();
}
示例7
@Override public void start(Stage stage) {
StackPane pane = new StackPane(gauge);
pane.setPadding(new Insets(20));
pane.setNodeOrientation(NodeOrientation.RIGHT_TO_LEFT);
LinearGradient gradient = new LinearGradient(0, 0, 0, pane.getLayoutBounds().getHeight(),
false, CycleMethod.NO_CYCLE,
new Stop(0.0, Color.rgb(38, 38, 38)),
new Stop(1.0, Color.rgb(15, 15, 15)));
//pane.setBackground(new Background(new BackgroundFill(gradient, CornerRadii.EMPTY, Insets.EMPTY)));
//pane.setBackground(new Background(new BackgroundFill(Color.rgb(39,44,50), CornerRadii.EMPTY, Insets.EMPTY)));
//pane.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY)));
//pane.setBackground(new Background(new BackgroundFill(Gauge.DARK_COLOR, CornerRadii.EMPTY, Insets.EMPTY)));
Scene scene = new Scene(pane);
scene.setNodeOrientation(NodeOrientation.RIGHT_TO_LEFT);
stage.setTitle("mars-sim");
stage.setScene(scene);
stage.show();
//gauge.setValue(50);
// Calculate number of nodes
calcNoOfNodes(pane);
System.out.println(noOfNodes + " Nodes in SceneGraph");
timer.start();
//gauge.getSections().get(0).setStart(10);
//gauge.getSections().get(0).setStop(90);
}
示例8
private void setFocusedSquare(ColorSquare square) {
hoverSquare.setVisible(square != null);
if (square == focusedSquare) {
return;
}
focusedSquare = square;
hoverSquare.setVisible(focusedSquare != null);
if (focusedSquare == null) {
return;
}
if (!focusedSquare.isFocused()) {
focusedSquare.requestFocus();
}
hoverSquare.rectangle.setFill(focusedSquare.rectangle.getFill());
Bounds b = square.localToScene(square.getLayoutBounds());
double x = b.getMinX();
double y = b.getMinY();
double xAdjust;
double scaleAdjust = hoverSquare.getScaleX() == 1.0 ? 0 : hoverSquare.getWidth() / 4.0;
if (colorPicker.getEffectiveNodeOrientation() == NodeOrientation.RIGHT_TO_LEFT) {
x = focusedSquare.getLayoutX();
xAdjust = -focusedSquare.getWidth() + scaleAdjust;
} else {
xAdjust = focusedSquare.getWidth() / 2.0 + scaleAdjust;
}
hoverSquare.setLayoutX(snapPosition(x) - xAdjust);
hoverSquare.setLayoutY(snapPosition(y) - focusedSquare.getHeight() / 2.0 + (hoverSquare.getScaleY() == 1.0 ? 0 : focusedSquare
.getHeight() / 4.0));
}
示例9
private IndeterminateSpinner(boolean spinEnabled, Paint fillOverride) {
this.spinEnabled = spinEnabled;
this.fillOverride = fillOverride;
setNodeOrientation(NodeOrientation.LEFT_TO_RIGHT);
getStyleClass().setAll("spinner");
pathsG = new IndicatorPaths();
getChildren().add(pathsG);
rebuild();
rebuildTimeline();
}
示例10
IndeterminateSpinner(TxConfidenceIndicator control, StaticProgressIndicatorSkin s,
boolean spinEnabled, Paint fillOverride) {
this.control = control;
this.skin = s;
this.fillOverride = fillOverride;
setNodeOrientation(NodeOrientation.LEFT_TO_RIGHT);
getStyleClass().setAll("spinner");
pathsG = new IndicatorPaths(this);
getChildren().add(pathsG);
rebuild();
}
示例11
private void initGraphics() {
markBox = new Region();
markBox.getStyleClass().setAll("mark");
markBox.setNodeOrientation(NodeOrientation.LEFT_TO_RIGHT);
markBox.setTranslateX(-27);
crossBox = new Region();
crossBox.getStyleClass().setAll("cross");
crossBox.setNodeOrientation(NodeOrientation.RIGHT_TO_LEFT);
crossBox.setTranslateX(27);
thumb = new Region();
thumb.getStyleClass().setAll("thumb");
thumb.setMinSize(48, 34);
thumb.setPrefSize(48, 34);
thumb.setMaxSize(48, 34);
if (getSkinnable().isSelected()) {
crossBox.setOpacity(0);
thumb.setTranslateX(24);
} else {
markBox.setOpacity(0);
thumb.setTranslateX(-24);
}
box.getStyleClass().setAll("box");
box.getChildren().addAll(markBox, crossBox, thumb);
updateChildren();
}
示例12
public Clock(@NamedArg(value="skinType", defaultValue="ClockSkinType.CLOCK") ClockSkinType skinType,
@NamedArg(value="updateInterval", defaultValue="1000") int updateInterval,
@NamedArg(value="checkSectionsForValue", defaultValue="false") boolean checkSectionsForValue,
@NamedArg(value="checkAreasForValue", defaultValue="false") boolean checkAreasForValue,
@NamedArg(value="sectionsVisible", defaultValue="false") boolean sectionsVisible,
@NamedArg(value="highlightSections", defaultValue="false") boolean highlightSections,
@NamedArg(value="areasVisible ", defaultValue="false") boolean areasVisible,
@NamedArg(value="highlightAreas", defaultValue="false") boolean highlightAreas,
@NamedArg(value="text", defaultValue="") String text,
@NamedArg(value="discreteSeconds", defaultValue="true") boolean discreteSeconds,
@NamedArg(value="discreteMinutes", defaultValue="true") boolean discreteMinutes,
@NamedArg(value="discreteHours", defaultValue="false") boolean discreteHours,
@NamedArg(value="secondsVisible", defaultValue="false") boolean secondsVisible,
@NamedArg(value="titleVisible", defaultValue="false") boolean titleVisible,
@NamedArg(value="textVisible", defaultValue="false") boolean textVisible,
@NamedArg(value="dateVisible", defaultValue="false") boolean dateVisible,
@NamedArg(value="dayVisible", defaultValue="false") boolean dayVisible,
@NamedArg(value="nightMode", defaultValue="false") boolean nightMode,
@NamedArg(value="running", defaultValue="false") boolean running,
@NamedArg(value="autoNightMode", defaultValue="false") boolean autoNightMode,
@NamedArg(value="backgroundPaint", defaultValue="#00000000") Color backgroundPaint,
@NamedArg(value="borderPaint", defaultValue="#00000000") Color borderPaint,
@NamedArg(value="borderWidth", defaultValue="1") double borderWidth,
@NamedArg(value="foregroundPaint", defaultValue="#00000000") Color foregroundPaint,
@NamedArg(value="titleColor", defaultValue="#242424") Color titleColor,
@NamedArg(value="textColor", defaultValue="#242424") Color textColor,
@NamedArg(value="dateColor", defaultValue="#242424") Color dateColor,
@NamedArg(value="hourTickMarkColor", defaultValue="#242424") Color hourTickMarkColor,
@NamedArg(value="minuteTickMarkColor", defaultValue="#242424") Color minuteTickMarkColor,
@NamedArg(value="tickLabelColor", defaultValue="#242424") Color tickLabelColor,
@NamedArg(value="alarmColor", defaultValue="#242424") Color alarmColor,
@NamedArg(value="hourTickMarksVisible", defaultValue="true") boolean hourTickMarksVisible,
@NamedArg(value="minuteTickMarksVisible", defaultValue="true") boolean minuteTickMarksVisible,
@NamedArg(value="tickLabelsVisible", defaultValue="true") boolean tickLabelsVisible,
@NamedArg(value="hourColor", defaultValue="#242424") Color hourColor,
@NamedArg(value="minuteColor", defaultValue="#242424") Color minuteColor,
@NamedArg(value="secondColor", defaultValue="#242424") Color secondColor,
@NamedArg(value="knobColor", defaultValue="#242424") Color knobColor,
@NamedArg(value="lcdDesign", defaultValue="LcdDesign.STANDARD") LcdDesign lcdDesign,
@NamedArg(value="alarmsEnabled", defaultValue="false") boolean alarmsEnabled,
@NamedArg(value="alarmsVisible", defaultValue="false") boolean alarmsVisible,
@NamedArg(value="lcdCrystalEnabled", defaultValue="false") boolean lcdCrystalEnabled,
@NamedArg(value="shadowsEnabled", defaultValue="false") boolean shadowsEnabled,
@NamedArg(value="lcdFont", defaultValue="LcdFont.DIGITAL_BOLD") LcdFont lcdFont,
@NamedArg(value="locale", defaultValue="Locale.US") Locale locale,
@NamedArg(value="tickLabelLocation", defaultValue="TickLabelLocation.INSIDE") TickLabelLocation tickLabelLocation,
@NamedArg(value="animated", defaultValue="false") boolean animated,
@NamedArg(value="animationDuration", defaultValue="10000") long animationDuration,
@NamedArg(value="customFontEnabled", defaultValue="false") boolean customFontEnabled,
@NamedArg(value="customFont", defaultValue="Fonts.robotoRegular(12)") Font customFont) {
setNodeOrientation(NodeOrientation.LEFT_TO_RIGHT);
this.skinType = skinType;
getStyleClass().add("clock");
init(ZonedDateTime.now());
registerListeners();
}
示例13
public JFXCheckBoxSkin(JFXCheckBox control) {
super(control, new ButtonBehavior<>(control));
indeterminateMark.getStyleClass().setAll("indeterminate-mark");
indeterminateMark.setOpacity(0);
indeterminateMark.setScaleX(0);
indeterminateMark.setScaleY(0);
mark.getStyleClass().setAll("mark");
mark.setNodeOrientation(NodeOrientation.LEFT_TO_RIGHT);
mark.setOpacity(0);
mark.setScaleX(0);
mark.setScaleY(0);
box.getStyleClass().setAll("box");
box.setBorder(new Border(new BorderStroke(control.getUnCheckedColor(),
BorderStrokeStyle.SOLID,
new CornerRadii(2),
new BorderWidths(2))));
box.getChildren().setAll(indeterminateMark, mark);
boxContainer = new StackPane();
boxContainer.getChildren().add(box);
boxContainer.getStyleClass().add("box-container");
rippler = new JFXRippler(boxContainer, RipplerMask.CIRCLE, JFXRippler.RipplerPos.BACK);
updateRippleColor();
// add listeners
control.selectedProperty().addListener(observable -> {
updateRippleColor();
playSelectAnimation(control.isSelected(), true);
});
control.indeterminateProperty().addListener(observable -> {
updateRippleColor();
playIndeterminateAnimation(control.isIndeterminate(), true);
});
// show focused state
control.focusedProperty().addListener((o, oldVal, newVal) -> {
if (!control.isDisableVisualFocus()) {
if (newVal) {
if (!getSkinnable().isPressed()) {
rippler.setOverlayVisible(true);
}
} else {
rippler.setOverlayVisible(false);
}
}
});
control.pressedProperty().addListener((o, oldVal, newVal) -> rippler.setOverlayVisible(false));
updateChildren();
// create animation
transition = new CheckBoxTransition(mark);
indeterminateTransition = new CheckBoxTransition(indeterminateMark);
createFillTransition();
registerChangeListener(control.checkedColorProperty(), "CHECKED_COLOR");
registerChangeListener(control.unCheckedColorProperty(), "UNCHECKED_COLOR");
}