下面列出了javafx.scene.control.Label#setRotate ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public AddressWithIconAndDirection(String text, String address, boolean received) {
Label directionIcon = new Label();
directionIcon.getStyleClass().add("icon");
directionIcon.getStyleClass().add(received ? "received-funds-icon" : "sent-funds-icon");
AwesomeDude.setIcon(directionIcon, received ? AwesomeIcon.SIGNIN : AwesomeIcon.SIGNOUT);
if (received)
directionIcon.setRotate(180);
directionIcon.setMouseTransparent(true);
setAlignment(Pos.CENTER_LEFT);
Label label = new AutoTooltipLabel(text);
label.setMouseTransparent(true);
HBox.setMargin(directionIcon, new Insets(0, 3, 0, 0));
HBox.setHgrow(label, Priority.ALWAYS);
hyperlink = new ExternalHyperlink(address);
HBox.setMargin(hyperlink, new Insets(0));
HBox.setHgrow(hyperlink, Priority.SOMETIMES);
// You need to set max width to Double.MAX_VALUE to make HBox.setHgrow working like expected!
// also pref width needs to be not default (-1)
hyperlink.setMaxWidth(Double.MAX_VALUE);
hyperlink.setPrefWidth(0);
getChildren().addAll(directionIcon, label, hyperlink);
}
private Label createExtentLabel() {
final Label newLabel = new Label();
// Align the text vertically:
newLabel.setRotate(270d);
// Fix the dimensions to prevent jittery motion on value changes:
newLabel.setMinWidth(150d);
newLabel.setPrefWidth(150d);
newLabel.setMaxWidth(150d);
newLabel.setMinHeight(30d);
newLabel.setPrefHeight(30d);
newLabel.setMaxHeight(30d);
newLabel.setAlignment(Pos.CENTER);
return newLabel;
}
private Tab getTab(Supplier<String> getter, Consumer<String> setter, String title) {
ContentEditor postEditor = new ContentEditor();
postEditor.setEditable(true);
postEditor.setContent(getter, setter);
postEditor.setContentTypePlugins(Collections.singletonList(new JavascriptContentType()));
postEditor.setContentType("application/javascript");
postEditor.setHeaderVisibility(false);
Tab postTab = new Tab("", postEditor);
Label label = new Label(title);
label.setRotate(90);
label.setMinWidth(150);
label.setMaxWidth(150);
label.setMinHeight(40);
label.setMaxHeight(40);
label.setPadding(new Insets(0));
postTab.setGraphic(label);
return postTab;
}
public void showAndWait(List<OptionPageProvider> optionPageProviders) {
JFXDialogLayout content = new OptionsDialogFxml(this);
content.setPrefWidth(600);
for(OptionPageProvider<?> p : optionPageProviders) {
OptionDialogPane pane = p.getOptionsDialog(new OptionDialogBuilder());
Tab tab = new Tab("", pane);
Label label = new Label(pane.getName());
label.setRotate(90);
label.setMinWidth(100);
label.setMaxWidth(100);
label.setMinHeight(40);
label.setMaxHeight(40);
tab.setGraphic(label);
tabs.getTabs().add(tab);
}
dialog = FxmlUtil.createDialog(content);
dialog.showAndWait();
}