Java Code Examples for javafx.scene.layout.AnchorPane#setPrefWidth()

The following examples show how to use javafx.scene.layout.AnchorPane#setPrefWidth() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ListNodePanel.java    From oim-fx with MIT License 6 votes vote down vote up
private Node getGapNode(double value) {
    AnchorPane tempPane = new AnchorPane();
    tempPane.setPrefWidth(value);
    tempPane.setPrefHeight(value);
    tempPane.setBackground(Background.EMPTY);
    return tempPane;
}
 
Example 2
Source File: HeadItem.java    From oim-fx with MIT License 6 votes vote down vote up
private Node getGapNode(double value) {
	AnchorPane tempPane = new AnchorPane();
	tempPane.setPrefWidth(value);
	tempPane.setPrefHeight(value);
	tempPane.setBackground(Background.EMPTY);
	return tempPane;
}
 
Example 3
Source File: MainFrame.java    From oim-fx with MIT License 5 votes vote down vote up
public Node getGapNode(double value) {
    AnchorPane pane = new AnchorPane();
    pane.setPrefWidth(value);
    pane.setPrefHeight(value);
    pane.setBackground(Background.EMPTY);
    return pane;
}
 
Example 4
Source File: TreeNode.java    From oim-fx with MIT License 5 votes vote down vote up
private Node getGapNode(double value) {
    AnchorPane tempPane = new AnchorPane();
    tempPane.setPrefWidth(value);
    tempPane.setPrefHeight(value);
    tempPane.setBackground(Background.EMPTY);
    return tempPane;
}
 
Example 5
Source File: FindGroupItem.java    From oim-fx with MIT License 5 votes vote down vote up
private Node getGapNode(double value) {
	AnchorPane tempPane = new AnchorPane();
	tempPane.setPrefWidth(value);
	tempPane.setPrefHeight(value);
	tempPane.setBackground(Background.EMPTY);
	return tempPane;
}
 
Example 6
Source File: FindUserItem.java    From oim-fx with MIT License 5 votes vote down vote up
private Node getGapNode(double value) {
	AnchorPane tempPane = new AnchorPane();
	tempPane.setPrefWidth(value);
	tempPane.setPrefHeight(value);
	tempPane.setBackground(Background.EMPTY);
	return tempPane;
}
 
Example 7
Source File: ShowAndHideFrame.java    From oim-fx with MIT License 5 votes vote down vote up
private void init() {

        loginButton.setText("点击");
        loginButton.setLayoutX(220);
        loginButton.setLayoutY(160);
        loginButton.setPrefWidth(60);

        AnchorPane userPane = new AnchorPane();
        userPane.setPrefWidth(240);
        userPane.setPrefHeight(180);

        userPane.getChildren().addAll(loginButton);


        this.setTitle("登录");
        this.setWidth(320);
        this.setHeight(260);
        this.setCenter(userPane);
        this.setBackground("Resources\\Images\\Wallpaper\\1.jpg");
    	
    	
        loginButton.setOnAction(new EventHandler<ActionEvent>() {

            @Override
            public void handle(ActionEvent event) {
            	if(mainFrame.isShowing()){
            		mainFrame.hide();
            	}else{
            		mainFrame.show();
            	}
            }
        });
    }
 
Example 8
Source File: MainScene.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
public void createMapToolBox() {		
		// Set up the map tool anchor pane
		mapToolAnchorPane = new AnchorPane();
		mapToolAnchorPane.setId("map-tool-anchor-pane");
		//mapToolAnchorPane.setStyle("-fx-background-color: lightgrey; ");
		// see https://introjava.wordpress.com/2012/03/23/java-fx-2-linear-gradients/
//		mapToolAnchorPane.setStyle(
////				"-fx-background-radius: 15px;"
////				+ "-fx-background-color:  linear-gradient(lightgrey, darkgrey);"
//				//+ "-fx-background-color: darkgrey;"
//					"-fx-background-color:"
//				+ "linear-gradient(#686868 0%, #232723 25%, #373837 75%, #757575 100%),"
//				+ "    linear-gradient(#020b02, #3a3a3a),"
//			    + "    linear-gradient(#9d9e9d 0%, #6b6a6b 20%, #343534 80%, #242424 100%),"
//			    + "    linear-gradient(#8a8a8a 0%, #6b6a6b 20%, #343534 80%, #262626 100%),"
//			    + "    linear-gradient(#777777 0%, #606060 50%, #505250 51%, #2a2b2a 100%);"
//			    + "-fx-background-insets: 0,1,4,5,6;"
//			    + "-fx-background-radius: 9,8,5,4,3;"
//			    + "-fx-padding: 1 1 1 1;"
////			    + "-fx-font-family: 'Helvetica';"
//			    + "-fx-font-size: 12px;"
////			    + "-fx-font-weight: bold;"
//			    + "-fx-opacity: .75;"
//			    + "-fx-text-fill: white;"
//			    + "-fx-effect: dropshadow( three-pass-box , rgba(255,255,255,0.2),1 ,0.0 ,0 ,1);"
//				);
//		mapToolAnchorPane.setOpacity(.75);
		mapToolAnchorPane.setPrefHeight(450);
		mapToolAnchorPane.setPrefWidth(140);
		
		sMapStackPane.getChildren().add(mapToolAnchorPane);
		
		AnchorPane.setTopAnchor(mapToolAnchorPane, 110.0);
		AnchorPane.setRightAnchor(mapToolAnchorPane, 20.0);
		
		createMapButtons();
		createMapCacheToggles();
		createFXSettlementComboBox();
		createFXZoomSlider();
		createFXMapLabelBox();

		anchorAllMapWidgets();
		
		// detect mouse wheel scrolling
		sMapStackPane.setOnScroll(new EventHandler<ScrollEvent>() {
			public void handle(ScrollEvent event) {

				if (event.getDeltaY() == 0)
					return;

				double direction = event.getDeltaY();

				if (direction > 0) {
					// Move zoom slider down.
					if (zoomSlider.getValue() > zoomSlider.getMin())
						zoomSlider.setValue((zoomSlider.getValue() - 1));
				} else if (direction < 0) {
					// Move zoom slider up.
					if (zoomSlider.getValue() < zoomSlider.getMax())
						zoomSlider.setValue((zoomSlider.getValue() + 1));
				}
				// event.consume();
			}
		});
	}