本文整理了Java中javafx.scene.layout.HBox.setStyle()
方法的一些代码示例,展示了HBox.setStyle()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HBox.setStyle()
方法的具体详情如下:
包路径:javafx.scene.layout.HBox
类名称:HBox
方法名:setStyle
暂无
代码示例来源:origin: stackoverflow.com
layout.setStyle("-fx-padding: 10; -fx-background-color: cornsilk;");
layout.getChildren().addAll(adminPane, viewPane, connectivityPane);
layout.setPrefHeight(150);
代码示例来源:origin: jfoenixadmin/JFoenix
@Override
public void start(Stage primaryStage) throws Exception {
JFXComboBox<Label> combo = new JFXComboBox<>();
combo.getItems().add(new Label("Java 1.8"));
combo.getItems().add(new Label("Java 1.7"));
combo.getItems().add(new Label("Java 1.6"));
combo.getItems().add(new Label("Java 1.5"));
combo.setEditable(true);
combo.setPromptText("Select Java Version");
combo.setConverter(new StringConverter<Label>() {
@Override
public String toString(Label object) {
return object==null? "" : object.getText();
}
@Override
public Label fromString(String string) {
return new Label(string);
}
});
HBox pane = new HBox(100);
HBox.setMargin(combo, new Insets(20));
pane.setStyle("-fx-background-color:WHITE");
pane.getChildren().add(combo);
final Scene scene = new Scene(pane, 300, 300);
scene.getStylesheets().add(ComboBoxDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
primaryStage.setTitle("JFX ComboBox Demo");
primaryStage.setScene(scene);
primaryStage.setResizable(false);
primaryStage.show();
}
代码示例来源:origin: jfoenixadmin/JFoenix
hbox.setSpacing(50);
hbox.setAlignment(Pos.CENTER);
hbox.setStyle("-fx-padding:20");
代码示例来源:origin: stackoverflow.com
public void tagButton(HBox box,String tag){
ImageView closeImg = new ImageView(toUse);
HBox button = new HBox();
button.setStyle("-fx-padding:4;" +
" -fx-border-width: 2;" +
" -fx-border-color: black;" +
" -fx-border-radius: 4;" +
" -fx-background-color: f1f1f1;" +
" -fx-border-insets: 5;");
button.setPrefHeight(20);
button.getChildren().addAll(new Label(tag),closeImg);
closeImg.setOnMouseClicked(event ->
box.getChildren().remove(button)
);
button.setOnMouseClicked(event -> {
//doSomethig
});
box.getChildren().add(button);
}
代码示例来源:origin: stackoverflow.com
public HBox addHBox(URL url) {
HBox hbox = new HBox();
hbox.setPadding(new Insets(15, 12, 15, 12));
hbox.setSpacing(10);
hbox.setStyle("-fx-background-color: #336699;");
hbox.setAlignment(Pos.TOP_CENTER);
Image photo = new Image(url, 300, 300, false, false);
ImageView myView = new ImageView(photo);
hbox.getChildren().add(myView);
return hbox;
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
@Override
protected void updateItem(Node item, boolean empty) {
super.updateItem(item, empty);
setGraphic(null);
setText(null);
if (!empty) {
rootLayout.setStyle("-fx-pref-height: 40;" + "-fx-border-width: 0;" + "-fx-alignment: CENTER_LEFT; " + "-fx-padding: 16;" + "-fx-spacing: 8;");
rootLayout.getChildren().add(item);
setGraphic(rootLayout);
}
}
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
/**
* @{inheritedDoc}
*/
@Override
public Node present(IEmaginController controller, VLViewComponentXML configuration, Object item) {
HBox node = new HBox();
node.setStyle("-fx-alignment:CENTER; -fx-spacing:4");
if(configuration.hasSubComponent()) {
for(VLViewComponentXML c: configuration.getSubcomponents()) {
Node n = _present(controller, c, item);
node.getChildren().add(n);
}
}
return node;
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
/**
* {@inheritDoc}
*/
@Override
public void buildFrom(IEmaginController controller, VLViewComponentXML configuration) {
getChildren().add(currentContent);
getChildren().add(pagination);
pagination.addEventFilter(MouseEvent.MOUSE_CLICKED, ev -> scrollRight());
currentContent.addEventFilter(MouseEvent.MOUSE_CLICKED, clickevent);
// currentContent.addEventFilter(TouchEvent.TOUCH_MOVED, clickevent);
currentContent.setAlignment(Pos.CENTER);
NodeHelper.setVgrow(currentContent);
pagination.setStyle("-fx-spacing:10;-fx-alignment:CENTER;-fx-padding:8 0 8 0;");
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
/**
* Constructor
*/
public TernaryMenuTabHeader() {
firstRowLayout.getChildren().addAll(leftTabIconsContainer, NodeHelper.horizontalSpacer(), rightTabIconsContainer);
secondRowLayout.getChildren().addAll(leftTabTitleContainer, NodeHelper.horizontalSpacer(), rightTabTitleContainer);
getChildren().addAll(firstRowLayout, secondRowLayout);
getStyleClass().addAll("ternary-menu-header");
rightTabIconsContainer.getStyleClass().add(SECONDARY_MENU_PIN_CONTAINER);
firstRowLayout.setAlignment(Pos.CENTER_LEFT);
leftTabIconsContainer.setAlignment(Pos.CENTER_LEFT);
rightTabIconsContainer.setAlignment(Pos.CENTER_LEFT);
secondRowLayout.setAlignment(Pos.CENTER_LEFT);
leftTabTitleContainer.setStyle("-fx-padding: 16;");
rightTabTitleContainer.setStyle("-fx-padding: 16;");
leftTabIconsContainer.setStyle("-fx-padding: 0 0 0 1;");
rightTabIconsContainer.setStyle("-fx-padding: 16;");
NodeHelper.setHVGrow(secondRowLayout);
}
代码示例来源: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.nexitia.emaginplatform/emagin-jfxcore-engine
/**
* {@inheritDoc}
*/
@Override
public void build(VLViewComponentXML blocConfig, IEmaginController controller) {
flowPane.setStyle("-fx-padding:8;-fx-spacing:8");
flowPane.setAlignment(Pos.CENTER);
if (blocConfig.hasSubComponent()) {
VLViewComponentXML subtabs = blocConfig.getComponentById("Tabs").orElse(null);
if (subtabs != null && subtabs.hasSubComponent()) {
List<IBuildable> buildables = ComponentUtils.resolveAndGenerate((AbstractViewController) controller, subtabs.getSubcomponents());
for(IBuildable e: buildables) {
flowPane.getChildren().add(e.getDisplay());
}
}
}
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
public static Node headerMessage(String message, String icon) {
HBox messagebox = new HBox();
messagebox.setStyle("-fx-spacing: 16;-fx-alignment:CENTER");
Label mss = new Label(message);
mss.getStyleClass().add("ep-header-message");
Label ic = new Label();
if(StringUtils.isNotBlank(icon)) {
IconUtils.setFontIcon(icon, ic);
ic.getGraphic().getStyleClass().add("white-ikonli");
}
messagebox.getChildren().addAll(ic, mss);
return messagebox;
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
/**
* Constructor
*/
public STVTopToolbar(AbstractViewController controller, VLViewComponentXML tableConfiguration) {
super();
this.controller = controller;
this.tableConfiguration = tableConfiguration;
modifyingToolbar.managedProperty().bind(modifyingToolbar.visibleProperty());
defaultToolbar.managedProperty().bind(defaultToolbar.visibleProperty());
NodeHelper.setHgrow(modifyingToolbar);
NodeHelper.setHgrow(defaultToolbar);
defaultToolbar.setVisible(true);
modifyingToolbar.setVisible(false);
defaultToolbar.setStyle("-fx-background-color: white;" + "-fx-alignment:CENTER_LEFT;" + "-fx-padding: 8 16 16 16;" + "-fx-spacing: 16;" + "-fx-border-color: -grey-color-300;"
+ "-fx-border-width: 0 0 1 0;" + "-fx-pref-height: 64;");
modifyingToolbar.setStyle("-fx-background-color: white;" + "-fx-alignment: CENTER;" + "-fx-padding: 16;" + "-fx-spacing: 16;" + "-fx-border-color: -border-color;" + "-fx-border-width: 0.25 0 0 0;"
+ "-fx-pref-height: 64;");
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
private void buildFilterToolbar() {
filtersToolbar.setStyle("-fx-background-color: white;" + "-fx-alignment:CENTER_LEFT;" + "-fx-padding: 16 16 16 64;" + "-fx-spacing:16;" + "-fx-border-color: -grey-color-300;"
+ "-fx-border-width: 0 0 1 0;" + "-fx-pref-height: 48;");
getChildren().add(filtersToolbar);
NodeHelper.setHgrow(filtersToolbar);
filtersToolbar.managedProperty().bind(filtersToolbar.visibleProperty());
final Hyperlink filterToolBarButton = new Hyperlink();
defaultToolbar.getChildren().add(filterToolBarButton);
filterToolBarButton.setOnAction(e -> {
filtersToolbar.visibleProperty().set(!filtersToolbar.visibleProperty().get());
});
filtersToolbar.setVisible(false);
}
代码示例来源: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
public InternalTab(final String title) {
this.title.set(title);
getStyleClass().setAll("InternalTab-primary");
toolbar.setStyle("-fx-background-color: white; " + "-fx-border-color: #e5e5e5; " + "-fx-border-width: 0 0 1 0;" + "-fx-padding: 15 5 8 5;");
toolbar.setSpacing(10);
toolbar.setPrefHeight(25);
toolbar.setVisible(false);
toolbar.setManaged(false);
setStyle("-fx-min-width: 100;" + "-fx-padding: 0 10 0 10");
}
代码示例来源:origin: stackoverflow.com
public class IPview {
private ImageView imgWebCamCapturedImage;
private BufferedImage grabbedImage;
private ObjectProperty<Image> imageProperty = new SimpleObjectProperty<Image>();
private HBox hbox;
public IPview(){
hbox = new HBox();
hbox.setPadding(new Insets(15, 12, 15, 12));
hbox.setSpacing(10);
hbox.setStyle("-fx-background-color: #336699;");
Button buttonCurrent = new Button("Current");
buttonCurrent.setPrefSize(100, 20);
Button buttonProjected = new Button("Projected");
buttonProjected.setPrefSize(100, 20);
hbox.getChildren().addAll(buttonCurrent, buttonProjected);
}
public Node getView() {
return hbox ;
}
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
private void buildActions() {
okButton.setFocusTraversable(false);
okButton.setText(controller.getGLocalised("SAVE_LABEL").toUpperCase());
cancelButton.setText(controller.getGLocalised("CANCEL_LABEL").toUpperCase());
cancelButton.setFocusTraversable(false);
actions.setStyle("-fx-padding: 32 0 0 32; -fx-alignment: CENTER_RIGHT;-fx-spacing:16;");
actions.getChildren().addAll(NodeHelper.horizontalSpacer(), okButton, cancelButton);
cancelButton.setOnAction(e -> {
hide();
});
okButton.setOnAction(e -> {
hide();
editInputComponent.commitModification();
});
editInputComponent.getContent().addEventHandler(KeyEvent.KEY_PRESSED, e -> {
if (e.getCode() == KeyCode.ENTER) {
hide();
}
});
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
/**
* @return
*/
public static Node headerVerticalSeparator() {
final HBox box = new HBox();
box.setStyle("-fx-background-color:white;-fx-opacity:0.70");
box.minHeightProperty().bind(box.prefHeightProperty());
box.maxHeightProperty().bind(box.prefHeightProperty());
box.minWidthProperty().bind(box.prefWidthProperty());
box.maxWidthProperty().bind(box.prefWidthProperty());
box.setPrefWidth(2);
box.setPrefHeight(30);
// translate the box because the toolbar is top right aligned
// we can not align the toolbar center, too complex to handle!!!
box.setTranslateY(-2);
return box;
}
代码示例来源:origin: org.jrebirth.af.showcase/todos
/**
* {@inheritDoc}
*/
@Override
protected void initView() {
super.initView();
node().setStyle("-fx-background-color:white");
node().setPadding(new Insets(10, 20, 10, 20));
node().setSpacing(40);
node().setAlignment(Pos.CENTER);
this.selectAll = new CheckBox();
this.todoText = new TextField();
this.todoText.setPrefWidth(Integer.MAX_VALUE);
HBox.setHgrow(this.todoText, Priority.ALWAYS);
node().getChildren().addAll(this.selectAll, this.todoText);
this.todoText.focusedProperty().addListener(this::textFocused);
}
内容来源于网络,如有侵权,请联系作者删除!