本文整理了Java中javafx.scene.control.Label.setStyle()
方法的一些代码示例,展示了Label.setStyle()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Label.setStyle()
方法的具体详情如下:
包路径:javafx.scene.control.Label
类名称:Label
方法名:setStyle
暂无
代码示例来源:origin: jfoenixadmin/JFoenix
label.setStyle(FX_BACKGROUND_COLOR_WHITE);
label.setPadding(new Insets(20));
JFXRippler rippler = new JFXRippler(label);
l1.setStyle(FX_BACKGROUND_COLOR_WHITE);
l1.setPadding(new Insets(20));
JFXRippler rippler1 = new JFXRippler(l1);
l2.setStyle(FX_BACKGROUND_COLOR_WHITE);
l2.setPadding(new Insets(20));
JFXRippler rippler2 = new JFXRippler(l2);
l3.setStyle(FX_BACKGROUND_COLOR_WHITE);
l3.setPadding(new Insets(20));
JFXRippler rippler3 = new JFXRippler(l3);
l4.setStyle(FX_BACKGROUND_COLOR_WHITE);
l4.setPadding(new Insets(20));
JFXRippler rippler4 = new JFXRippler(l4);
l5.setStyle(FX_BACKGROUND_COLOR_WHITE);
l5.setPadding(new Insets(20));
JFXRippler rippler5 = new JFXRippler(l5);
代码示例来源:origin: jfoenixadmin/JFoenix
title.setStyle("-fx-text-fill:WHITE; -fx-font-size: 40;");
JFXScrollPane.smoothScrolling((ScrollPane) pane.getChildren().get(0));
代码示例来源:origin: jfoenixadmin/JFoenix
JFXButton ssbutton1 = new JFXButton();
Label sslabel = new Label("R1");
sslabel.setStyle(FX_TEXT_FILL_WHITE);
ssbutton1.setGraphic(sslabel);
ssbutton1.setButtonType(ButtonType.RAISED);
slabel.setStyle(FX_TEXT_FILL_WHITE);
sbutton1.setGraphic(slabel);
sbutton1.setButtonType(ButtonType.RAISED);
Label label = new Label("G1");
button1.setGraphic(label);
label.setStyle(FX_TEXT_FILL_WHITE);
button1.setButtonType(ButtonType.RAISED);
button1.getStyleClass().add(ANIMATED_OPTION_BUTTON);
代码示例来源:origin: com.aquafx-project/aquafx
@Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue,
Boolean newValue) {
if (newValue) {
type.setStyle("-fx-text-fill: white;");
legend.setStyle("-fx-font-size: 11; -fx-text-fill: white;");
} else {
type.setStyle("-fx-text-fill: black;");
legend.setStyle("-fx-font-size: 11; -fx-text-fill: gray;");
}
}
});
代码示例来源:origin: com.powsybl/powsybl-gse-security-analysis
private static Label createTitle(String text) {
Label label = new Label(text + ":");
label.setStyle("-fx-font-weight: bold");
return label;
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
/**
* Build the help text and the error label
*/
protected void buildHelpTextAndErrorText() {
errorText.setVisible(false);
errorText.setStyle("-fx-text-fill:red;" + "-fx-font-size:0.9em;" +
"-fx-padding:4 0 8 0;-fx-font-weight:bold");
}
代码示例来源:origin: stackoverflow.com
public void setLabelStyle(Label label) {
label.setStyle("-fx-font-family: Inconsolata:700; -fx-font-size: 25");
Scene scene = new Scene(label);
scene.getStylesheets().add("https://fonts.googleapis.com/css?family=Inconsolata:700");
label.setTextFill(Color.GRAY);
代码示例来源:origin: stackoverflow.com
fontVerkleinerung(lblXYZ); //call resizing at beginning
lblXYZ.styleProperty().addListener((observable, oldV, newV) -> {
fontVerkleinerung(lblXYZ); //check size again if resized
});
private void fontVerkleinerung(Label label) {
Platform.runLater(() -> {
tpBounds = tPane.getBoundsInLocal();
if (label.getBoundsInLocal().getWidth()>tpBounds.getWidth() && !fontSizeFits) {
fontSize = fontSize-0.02;
label.setStyle("-fx-font-size: "+fontSize+"em;");
}
if (label.getBoundsInLocal().getWidth()<=tpBounds.getWidth() && !fontSizeFits) {
fontSizeFits = true;
}
});
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxplatform-components
@Override
public Node getDisplayIdentity() {
if(identityPresenter != null) {
Node node = identityPresenter.provideIdentityOf(this, getRootComponent());
return node;
}
OperationData data = getOpData();
Label identity = new Label("Structure of " + data.getMasterAttributes().get("name"));
identity.setStyle("-fx-text-fill:white;-fx-font-size:12px;");
return identity;
}
代码示例来源:origin: de.jensd/fontawesomefx-common
public Label createIconLabel(GlyphIcons icon, String text, String iconSize, String fontSize, ContentDisplay contentDisplay) {
Text iconLabel = createIcon(icon, iconSize);
Label label = new Label(text);
label.setStyle("-fx-font-size: " + fontSize);
label.setGraphic(iconLabel);
label.setContentDisplay(contentDisplay);
return label;
}
代码示例来源:origin: com.cedarsoft.commons/javafx
@Nonnull
public static Label placeholder(@Nonnull String text) {
Label placeholder = new Label(text);
placeholder.setFont(new Font(30.0));
placeholder.setTextFill(Color.gray(0.4));
placeholder.setTextAlignment(TextAlignment.CENTER);
placeholder.setAlignment(Pos.CENTER);
placeholder.setStyle("-fx-background-color: #f8f8f8");
return placeholder;
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
/**
* Constructor
*/
public NoContentPane() {
getStyleClass().add("no-content-pane");
noContentMessage.setWrapText(true);
noContentMessage.setStyle("no-content-pane-message");
managedProperty().bind(visibleProperty());
setAlignment(Pos.CENTER);
NodeHelper.setHVGrow(this);
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
/**
* <component id="TitleToolBarActions"> <component id="ActionGroup"> <component ref="ExportButton"/>
* </component>
*
* <component id="ActionGroup"> <component ref="EllipsisButton"/> </component> </component>
*/
// @formatter:on
private void buildTitleToolbar() {
titleToolbar.getChildren().addAll(title, NodeHelper.horizontalSpacer());
titleToolbar.setStyle("-fx-background-color: white;" + "-fx-alignment:CENTER_LEFT;" + "-fx-padding: 16 16 16 16;" + "-fx-spacing: 16;" + "-fx-border-color: -grey-color-300;"
+ "-fx-border-width: 0 0 0 0;" + "-fx-pref-height: 64;");
title.setStyle("-fx-font-family: 'Roboto Regular';" + "-fx-font-size: 2.3em;" + "-fx-opacity: 0.87;");
getChildren().add(titleToolbar);
buildEllipsisMenu();
titleToolbar.getChildren().addAll(ellispsis != null ? ellispsis : new HBox());
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
/**
* {@inheritDoc}
*/
@Override
public void buildFrom(IEmaginController controller, VLViewComponentXML configuration) {
super.buildFrom(controller, configuration);
String title = (String) getForData().getAttributes().get("title");
if (StringUtils.isNotBlank(title)) {
label.setText(controller.getLocalised(title));
label.setStyle("-fx-font-family:'Roboto Light';-fx-font-size:12px");
}
this.listValuekey = (String) getForData().getAttributes().get("listValueKey");
this.key = (String) getForData().getAttributes().get("key");
this.singleSelectedValueKey = (String) getForData().getAttributes().get("key");
String dtl = getForData().getAttributes().get("dataLoader") == null ? "ByKeySingleListFormDataLoader" : (String) getForData().getAttributes().get("dataLoader");
dataLoader = (IListFormDataLoader) Services.getBean(dtl);
dataLoader.setController(controller);
if(StringUtils.isNotBlank(getKey())) {
loadCurrentValue();
}
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
public Node getTitle() {
final HBox tabTileContainer = new HBox();
tabTileContainer.setAlignment(Pos.CENTER);
tabTileContainer.setSpacing(5);
final Label titleLabel = new Label();
titleLabel.textProperty().bind(title);
tabTileContainer.getChildren().add(titleLabel);
titleLabel.setStyle("-fx-font-size: 13px;-fx-font-weight: bold;" + "-fx-text-fill: #3b5998;" + "-fx-font-family: helvetica, arial, sans-serif");
final Label counterLabel = new Label();
counterLabel.textProperty().set(" ");
tabTileContainer.getChildren().add(counterLabel);
setAlignment(Pos.CENTER);
getChildren().addAll(tabTileContainer);
return this;
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
/**
* Constructor
*/
public LoadingPane() {
setStyle("-fx-padding:64 32 32 32 64;");
rootContainer.setStyle("-fx-min-height: 128;-fx-background-color: white; " + "-fx-border-color: transparent transparent -external-border-color -accent-color;" + "-fx-border-width: 0 0 0.2 6;"
+ "-fx-alignment:CENTER;" + "-fx-padding:16;" + "-fx-effect: dropshadow(three-pass-box, derive(grey, 50%), 2, 0.2, 0, 0);");
NodeHelper.setHVGrow(iconContainer);
iconContainer.getChildren().add(icon);
iconContainer.setStyle("-fx-background-color:white;" + "-fx-alignment:CENTER_LEFT;" + "-fx-padding:16 64 16 64");
label.setText("I am loading datas :-)");
label.setWrapText(true);
label.setStyle("-fx-font-family:'Robotom Medium'; " + "-fx-font-size: 1.6em;" + "-fx-text-fill:-grey-color-600;");
rootContainer.getChildren().addAll(NodeHelper.horizontalSpacer(), label, iconContainer, NodeHelper.horizontalSpacer());
NodeHelper.setHgrow(rootContainer);
getChildren().add(rootContainer);
}
代码示例来源:origin: com.github.giulianini.jestures/jestures
/**
* Wrap a {@link JFXListView} on a {@link JFXScrollPane} adding functionality.
*
* @param pane
* the {@link JFXScrollPane} pane
* @param node
* the {@link Node}
* @param titleString
* the {@link String} title
* @param cssId
* the cssId
*/
// CHECKSTYLE:OFF Magicnumber AH DI MI TOCCA
public static void wrapNodeOnScrollPane(final JFXScrollPane pane, final Node node, final String titleString,
final String cssId) {
// list.setMinHeight(1000); //ACTIVATE SCROLL
final StackPane container = new StackPane(node);
container.setPadding(new Insets(-1));
pane.setContent(container);
final Label title = new Label(titleString);
pane.getBottomBar().getChildren().add(title);
title.setStyle("-fx-text-fill:WHITE; -fx-font-size: 40;");
StackPane.setMargin(title, new Insets(0, 0, 0, 80));
StackPane.setAlignment(title, Pos.CENTER_LEFT);
pane.getMainHeader().setId(cssId);
// CHECKSTYLE:ON Magicnumber
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
private void buildSearchFilter() {
tabHeader.getChildren().add(searchField);
searchField.getStyleClass().removeAll("custom-text-field");
searchField.getStyleClass().add("list-view-header-search-field");
// right search icon
Label icon = new Label();
icon.setStyle("-fx-padding:0 0 0 8");
FontIcon searchfontIcon = new FontIcon();
searchfontIcon.setStyle("-fx-icon-color:-accent-color-300;-fx-icon-code:mdi-magnify;-fx-icon-size:18;");
icon.setGraphic(searchfontIcon);
// left filters button
FontIcon fontIcon = new FontIcon();
fontIcon.setStyle("-fx-icon-color:-accent-color-300;-fx-icon-code:mdi-filter;-fx-icon-size:18;");
HBox rightnode = new HBox();
rightnode.setAlignment(Pos.CENTER);
rightnode.getChildren().addAll(icon);
searchField.setLeft(rightnode);
searchField.textProperty().addListener((ChangeListener<String>) (observable, oldValue, newValue) -> {
search(oldValue, newValue);
});
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
/**
* @param o
*/
public void showNotification(Notification o) {
final Label label = new Label();
label.setText(o.getTitle());
topToolbar.getChildren().clear();
topToolbar.getChildren().add(label);
NotificationView.iconify(label, o.getLevel());
final FadeTransition ft = new FadeTransition(Duration.millis(4000));
ft.setNode(label);
ft.setFromValue(1);
ft.setCycleCount(1);
ft.setToValue(0.0);
ft.setAutoReverse(true);
ft.play();
label.setStyle("-fx-text-fill: white;" + "-fx-font-size:1.2em;" + "-fx-padding: 4 32 4 32;" + "-fx-background-color: -accent-color;" + "-fx-border-radius: 30;" + "-fx-background-radius:30;");
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
/**
* Constructor
*/
public STVBottomToolbar() {
super();
setStyle("-fx-background-color: white;" + "-fx-border-width: 0 0 0;" + "-fx-padding: 0 16 0 16;" + "-fx-min-height: 88;" + "-fx-alignment: CENTER_RIGHT;" + "-fx-spacing: 16;");
next.setTooltip(new Tooltip("Next"));
next.disableProperty().bind(Bindings.not(hasNext));
back.setTooltip(new Tooltip("Back"));
back.disableProperty().bind(Bindings.not(hasPrevious));
elementCount.setStyle("-fx-font-family: 'Roboto Regular';" + "-fx-font-size: 1.3em;" + "-fx-opacity: 0.87;" + "-fx-padding: 0 32 0 0;");
// add all
getChildren().addAll(elementCount, NodeHelper.horizontalSpacer(), back, next);
}
内容来源于网络,如有侵权,请联系作者删除!