当前位置: 首页>>代码示例>>Java>>正文


Java HBox.setSpacing方法代码示例

本文整理汇总了Java中javafx.scene.layout.HBox.setSpacing方法的典型用法代码示例。如果您正苦于以下问题:Java HBox.setSpacing方法的具体用法?Java HBox.setSpacing怎么用?Java HBox.setSpacing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.layout.HBox的用法示例。


在下文中一共展示了HBox.setSpacing方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: start

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250);
    stage.setScene(scene);
    stage.setTitle("Progress Controls");

    for (int i = 0; i < values.length; i++) {
        final Label label = labels[i] = new Label();
        label.setText("progress:" + values[i]);

        final ProgressBar pb = pbs[i] = new ProgressBar();
        pb.setProgress(values[i]);

        final ProgressIndicator pin = pins[i] = new ProgressIndicator();
        pin.setProgress(values[i]);
        final HBox hb = hbs[i] = new HBox();
        hb.setSpacing(5);
        hb.setAlignment(Pos.CENTER);
        hb.getChildren().addAll(label, pb, pin);
    }

    final VBox vb = new VBox();
    vb.setSpacing(5);
    vb.getChildren().addAll(hbs);
    scene.setRoot(vb);
    stage.show();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:29,代码来源:ProgressSample.java

示例2: createTopBar

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
private HBox createTopBar()
{
	HBox counterHBox = new HBox();
	counterHBox.setPadding(new Insets(15, 15, 15, 15));
	counterHBox.setSpacing(10);
	
	Label programCounterLabel = new Label("Program Count");
	programCounterLabel.setFont(Font.font("Arial", FontWeight.NORMAL, 16));
	
	TextField programCounterText = new TextField();
	programCounterText.setPrefWidth(50);
	
	Label nextInstructionLabel = new Label("Next Instruction");
	nextInstructionLabel.setFont(Font.font("Arial", FontWeight.NORMAL, 16));
	
	TextField nextInstructionText = new TextField();
	nextInstructionText.setPrefWidth(200);
	counterHBox.getChildren().addAll(programCounterLabel, programCounterText,
			nextInstructionLabel, nextInstructionText);
			
	return counterHBox;
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:23,代码来源:CpuWindow.java

示例3: initSystemSettings

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
private HBox initSystemSettings() {
	HBox settingBox = new HBox();
	settingBox.setAlignment(Pos.TOP_RIGHT);
	settingBox.setSpacing(15);

	Button musicButton = new Button();
	ImageView musicImageView = new ImageView(
			new Image(getClass().getClassLoader().getResourceAsStream(myResources.getString("music"))));
	musicImageView.setFitWidth(20);
	musicImageView.setPreserveRatio(true);
	musicButton.setGraphic(musicImageView);
	musicButton.setOnMousePressed(e -> {
		// TODO show a menu of several choices of background music
		System.out.println("Here should be a menu of background music choices.");
	});
	settingBox.getChildren().add(musicButton);
	return settingBox;
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:19,代码来源:GameManager.java

示例4: start

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
@Override public void start(Stage stage) {
    HBox pane = new HBox(clock1, clock2);
    pane.setSpacing(20);

    Scene scene = new Scene(pane);

    stage.setTitle("Medusa Clock Control");
    stage.setScene(scene);
    stage.show();

    // Calculate number of nodes
    calcNoOfNodes(pane);
    System.out.println(noOfNodes + " Nodes in SceneGraph");
}
 
开发者ID:BITPlan,项目名称:can4eve,代码行数:15,代码来源:ClockControl.java

示例5: ImagePropertiesSample

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
public ImagePropertiesSample() {
    //we can set image properties directly during creation
    ImageView sample1 = new ImageView(new Image(url, 30, 70, false, true));

    ImageView sample2 = new ImageView(new Image(url));
    //image can be resized to preferred width
    sample2.setFitWidth(200);
    sample2.setPreserveRatio(true);
    
    ImageView sample3 = new ImageView(new Image(url));
    //image can be resized to preferred height
    sample3.setFitHeight(20);
    sample3.setPreserveRatio(true);
    
    ImageView sample4 = new ImageView(new Image(url));
    //one can resize image without preserving ratio between height and width
    sample4.setFitWidth(40);
    sample4.setFitHeight(80);
    sample4.setPreserveRatio(false);
    sample4.setSmooth(true); //the usage of the better filter

    ImageView sample5 = new ImageView(new Image(url));
    sample5.setFitHeight(60);
    sample5.setPreserveRatio(true);
    //viewport is used for displaying the part of image
    Rectangle2D rectangle2D = new Rectangle2D(50, 200, 120, 60);
    sample5.setViewport(rectangle2D);

    //add the imageviews to layout
    HBox hBox = new HBox();
    hBox.setSpacing(10);
    hBox.getChildren().addAll(sample1, sample3, sample4, sample5);

    //show the layout
    VBox vb = new VBox(10);
    vb.getChildren().addAll(hBox, sample2);
    getChildren().add(vb);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:39,代码来源:ImagePropertiesSample.java

示例6: getNode

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
@Override
public Node getNode() {
	// TODO Auto-generated method stub
	HBox hb = new HBox();
	hb.setPadding(new Insets(15, 12, 15, 12));
	hb.setSpacing(10);
	hb.getChildren().addAll(getButtons().values());
	
	return hb;
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:11,代码来源:MenuBarManager.java

示例7: createRadioButtons

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
private HBox createRadioButtons() {
    //creates a radio buttons, for each rectangle 2 buttons with action .toFront() and toBack()
    ToggleGroup tg = new ToggleGroup();
    
    VBox vBox1 = new VBox();
    vBox1.setSpacing(5);
    vBox1.setLayoutY(6);
    vBox1.getChildren().addAll(
            createRadioButton(rectA, "A.toFront()", true, tg),
            createRadioButton(rectB, "B.toFront()", true, tg),
            createRadioButton(rectC, "C.toFront()", true, tg)
            );

    VBox vBox2 = new VBox();
    vBox2.setSpacing(5);
    vBox2.setLayoutY(6);
    vBox2.getChildren().addAll(
            createRadioButton(rectA, "A.toBack()", false, tg),
            createRadioButton(rectB, "B.toBack()", false, tg),
            createRadioButton(rectC, "C.toBack()", false, tg)
            );

    HBox hBox = new HBox();
    hBox.setSpacing(10);
    hBox.getChildren().addAll(vBox1, vBox2);
    return hBox;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:28,代码来源:NodePropertiesSample.java

示例8: createControlPane

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
private HBox createControlPane()
{
	HBox hbox = new HBox();
	setAlignment(hbox, Pos.CENTER);
	hbox.setAlignment(Pos.CENTER_LEFT);
	hbox.setPadding(new Insets(10, 10, 10, 10));
	hbox.setSpacing(5);
	
	Label label = new Label("Send");
	label.setMinWidth(Label.USE_PREF_SIZE);
	hbox.getChildren().add(label);
	
	ComboBox<String> dropdown = createDisplayOptionsDropdown();
	dropdown.setMinWidth(ComboBox.USE_PREF_SIZE);
	hbox.getChildren().add(dropdown);
	
	TextField valueField = new TextField();
	valueField.setPrefWidth(Integer.MAX_VALUE);
	hbox.getChildren().add(valueField);
	
	Button send = new Button("Send");
	send.setMinWidth(Button.USE_PREF_SIZE);
	hbox.getChildren().add(send);
	
	Button clear = new Button("Clear");
	clear.setMinWidth(Button.USE_PREF_SIZE);
	clear.setOnAction((event) -> clear());
	hbox.getChildren().add(clear);
	
	return hbox;
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:32,代码来源:UARTPanel.java

示例9: ColorButtonSample

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
public ColorButtonSample() {
    HBox hBox = new HBox();
    hBox.setSpacing(5);
    for(int i=0; i<7; i++) {
        Button b = new Button("Color");
        b.setStyle("-fx-base: rgb("+(10*i)+","+(20*i)+","+(10*i)+");");
        hBox.getChildren().add(b);
    }
    HBox hBox2 = new HBox();
    hBox2.setSpacing(5);
    hBox2.setTranslateY(30);
    Button red = new Button("Red");
    red.setStyle("-fx-base: red;");
    Button orange = new Button("Orange");
    orange.setStyle("-fx-base: orange;");
    Button yellow = new Button("Yellow");
    yellow.setStyle("-fx-base: yellow;");
    Button green = new Button("Green");
    green.setStyle("-fx-base: green;");
    Button blue = new Button("Blue");
    blue.setStyle("-fx-base: rgb(30,170,255);");
    Button indigo = new Button("Indigo");
    indigo.setStyle("-fx-base: blue;");
    Button violet = new Button("Violet");
    violet.setStyle("-fx-base: purple;");
    hBox2.getChildren().add(red);
    hBox2.getChildren().add(orange);
    hBox2.getChildren().add(yellow);
    hBox2.getChildren().add(green);
    hBox2.getChildren().add(blue);
    hBox2.getChildren().add(indigo);
    hBox2.getChildren().add(violet);

    VBox vBox = new VBox(20);
    vBox.getChildren().addAll(hBox,hBox2);
    getChildren().add(vBox);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:38,代码来源:ColorButtonSample.java

示例10: Dialog

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
public Dialog(String msg) {
	setResizable(false);
       initStyle(StageStyle.TRANSPARENT);
       initOwner(Main.getPrimaryStage());
       initModality(Modality.WINDOW_MODAL);

       label = new Label(msg);
       label.setWrapText(true);
       label.setGraphicTextGap(20);
       label.getStyleClass().add("label");
       
       borderPane = new BorderPane();
       
       dropShadowPane = new BorderPane();
       dropShadowPane.getStyleClass().add("content");
       dropShadowPane.setTop(label);

       hbox = new HBox();
       hbox.setSpacing(15);
       
       // calculate width of string
       text = new Text(msg);
       text.snapshot(null, null);
       
       int width = 300;
       int height = 100;

       this.setWidth(width);
       this.setHeight(height);

       // make sure this stage is centered on top of its owner
       this.setX(Main.getPrimaryStage().getX() + (Main.getPrimaryStage().getWidth() / 2 - this.getWidth() / 2));
       this.setY(Main.getPrimaryStage().getY() + (Main.getPrimaryStage().getHeight() / 2 - this.getHeight() / 2));
}
 
开发者ID:Team-Sprout,项目名称:Clipcon-Client,代码行数:35,代码来源:Dialog.java

示例11: initGUI

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
private void initGUI() {
    //Search facility
    Label searchLabel = new Label();
    Image dirImage = new Image("icon/ZOOM_IN.png");
    searchLabel.setGraphic(new ImageView(dirImage));
    keywordInput = new TextField("Type in search keyword...");
    keywordInput.setPrefWidth(230);
    //Add actionlistener
    keywordInput.textProperty().addListener((observalbe, oldvalue, newvalue)->{           
       updateTreeView(newvalue.toUpperCase());
    });
    //Add focus listener
    keywordInput.focusedProperty().addListener((observalbe, oldvalue, newvalue)->{
        if (newvalue) {
           if (getNodeLayerCount(currentSelectedNode) >= 2) {
              keywordInput.setText("");
           }
        }
    });
    HBox hBox = new HBox();
    hBox.setSpacing(5);
    hBox.getChildren().addAll(searchLabel, keywordInput);
    setTop(hBox); 
    treeView = new TreeView();
    treeView.setMinWidth(200);;
    treeView.setEditable(false);
    treeView.setOnMouseClicked(onTreeItemClicked()); //<-Handle mouse click event
    setCenter(treeView);
}
 
开发者ID:ztan5,项目名称:TechnicalAnalysisTool,代码行数:30,代码来源:MarketDataTreeViewNode.java

示例12: SimpleVariableSetter

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
public SimpleVariableSetter(Class<T> type,String descriptor) throws UnsupportedTypeException{
	super(type, descriptor);
	HBox box =new HBox();
	this.type=type;
	value=new TextField();
	this.getChildren().add(box);
	box.getChildren().addAll(value);
	box.setSpacing(50);
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:10,代码来源:SimpleVariableSetter.java

示例13: start

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
@Override
	public void start(Stage primaryStage) {
		try {
//			Image setting = new Image(getClass().getResourceAsStream("setting.png"j));
			Image logoimg = new Image(getClass().getResourceAsStream("logo.png"));
//			Button settingbtn = new Button("",new ImageView(setting));
//			settingLabel.setStyle("-fx-background-color:#1d1d1d");
			JFXButton logobtn = new JFXButton("",new ImageView(logoimg));
			Label title = new Label("       Energy Saving System");
			title.setFont(new Font(30));
			title.setPrefSize(650, 60);
			title.setStyle("-fx-background-color:#1d1d1d; \n -fx-text-fill:white ;");
			HBox hbox = new HBox();
			hbox.setStyle("-fx-background-color:#1d1d1d");
			hbox.setSpacing(10);
			hbox.setPadding(new Insets(10,10,10,10));
			hbox.getChildren().addAll(logobtn,title);
			BorderPane root = new BorderPane();
			root.setTop(hbox);
			JFXTabPane pane = new JFXTabPane();
			pane.setSide(Side.RIGHT);
			Tab tab1 = new Tab();
			Tab tab2 = new Tab();
			Tab tab3 = new Tab();
			tab3.setText("Settings");
			tab2.setText("Tweaks");
			tab2.setContent(new Tweaks().getPane());
			tab1.setText("Statistics");
			tab1.setContent(new ChartControls().getPane());
			pane.getTabs().addAll(tab1,tab2,tab3);
			root.setCenter(pane);
			Scene scene = new Scene(root,910,550);
			scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
			primaryStage.setScene(scene);
			primaryStage.show();
			
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
 
开发者ID:naeemkhan12,项目名称:IOTproject,代码行数:41,代码来源:Main.java

示例14: PromptTab

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
public PromptTab()
{
    super();
    super.setText("Confirmation Required");
    super.setClosable(false);
    
    pane = new Pane();
    contentBox = new VBox(); 
    buttonBox = new HBox();
    header = new Label();
    desc = new Label();
    
    yesButton = new Button("Yes");
    yesButton.setPrefWidth(50);
    
    noButton = new Button("No");
    noButton.setPrefWidth(50);
    
    buttonBox.getChildren().addAll(yesButton, noButton);
    buttonBox.setSpacing(10);
    
    contentBox.getChildren().addAll(header, desc, buttonBox);
    contentBox.setPadding(new Insets(15, 15, 15, 15));
    contentBox.setSpacing(15);
    
    pane.setPrefHeight(AppTabPane.CONTENT_HEIGHT);
    pane.setPrefWidth(AppTabPane.CONTENT_WIDTH);
    pane.getChildren().add(contentBox);
    
    super.setContent(pane);
}
 
开发者ID:BlueGoliath,项目名称:Goliath-Overclocking-Utility-FX,代码行数:32,代码来源:PromptTab.java

示例15: showUsers

import javafx.scene.layout.HBox; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void showUsers()
{
	primaryStage = new Stage();
	primaryStage.setTitle("e-Tracker Users");
	primaryStage.setResizable(false);
	primaryStage.initModality(Modality.APPLICATION_MODAL);
	primaryStage.getIcons().add(new Image("/pic/slogo.png"));
	//name
	namecol = new TableColumn<>("Username");
	namecol.setMinWidth(250);
	namecol.setCellValueFactory(new PropertyValueFactory<>("name"));//has to be the same as in the UserCreation class
			
	//level
	levelcol = new TableColumn<>("User Level");
	levelcol.setMinWidth(250);
	levelcol.setCellValueFactory(new PropertyValueFactory<>("level"));
	
	table= new TableView<>();
	table.setItems(getProduct());
	table.getColumns().addAll(namecol, levelcol);
	table.getSelectionModel().selectedItemProperty().addListener(
               (observable, oldValue, newValue) -> showPersonDetails(newValue));
	
	txtname= new TextField();
	txtname.setEditable(false);
	txtname.setPromptText("Username");
	
	txtlevel= new TextField();
	txtlevel.setEditable(false);
	txtlevel.setPromptText("User Level e.g. Admin");
	
	badd= new Button("Add...");
	badd.setOnAction(e ->{
		addClicked();
	});
	bdel= new Button("Delete");
	bdel.setOnAction(e ->{
		deleteClicked();
	});
	
	bedit= new Button("Edit...");
	bedit.setOnAction( e ->{
		setPressbEdit();
	});

	HBox layout2= new HBox();
	layout2.setSpacing(10); //similar to that 10
	//layout2.setPadding(new Insets(20,20,20,20));
	layout2.getChildren().addAll(txtname, txtlevel, bedit, badd, bdel);
	layout2.setAlignment(Pos.CENTER_RIGHT);
	
	VBox layout = new VBox(12);
	layout.getChildren().addAll(table, layout2);
	layout.setPadding(new Insets(20,20,20,20));
	layout.setStyle("-fx-background-color: linear-gradient(#E4E9A9, #9CD777);");
	Scene scene= new Scene(layout);
	scene.getStylesheets().add(Users.class.getResource("users.css").toExternalForm());
	primaryStage.setScene(scene);
	
	if(MainWindow.ladmins.getText().equals("User") || MainWindow.ladmins.getText().equals("Office Admin") || 
	   MainWindow.ladmins.getText().equals("Gate Admin"))
	{
		badd.setDisable(true);
		bdel.setDisable(true);
		bedit.setDisable(true);
	}
}
 
开发者ID:mikemacharia39,项目名称:gatepass,代码行数:69,代码来源:Users.java


注:本文中的javafx.scene.layout.HBox.setSpacing方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。