• topAnchor: pane's top insets to the child's top edge.
  • leftAnchor
  • rightAnchor
  • bottomAnchor

A set of inside offsets for the 4 side of a rectangular area

  • Constructor and Description
  • Insets(double topRightBottomLeft)
    Constructs a new Insets instance with same value for all four offsets.
  • Insets(double top, double right, double bottom, double left)
    Constructs a new Insets instance with four different offsets.
Code :

package javafxtemplate1;
//textProperty().addListener Listview Label
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.Separator;
import javafx.scene.control.ToolBar;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import java.lang.Boolean;
import javafx.scene.layout.AnchorPane;

* @author Manas9
public class JavaFXTemplate1 extends Application {
//ImageView imageView = new ImageView();
//Button clearBtn = new Button("Clear Image");
//Node imagenode;
Label label1 =new Label("L1");
Label label2 =new Label("L1");
Scene scene;
//Pane pane1 = new Pane();
FlowPane pane1 = new FlowPane();
HBox hb1 = new HBox(10); HBox hb2 = new HBox(10);
String str1; Color color1 ;//= new Color();
public void start(Stage primaryStage) throws Exception {
ToolBar toolBar1,toolBar2,toolBar3 ;
boolean ok = true;
toolBar1 = new ToolBar(
new Button("New"),
new Button("Open"),
new Button("Save"),
new Separator(),
new Button("Clean"));
toolBar2 = new ToolBar(
new Button("Compile"),
new Button("Run"),
new Separator(),
new Button("Debug"),
new Button("Profile")
toolBar3 = new ToolBar( new Separator());
//ap1 = new AnchorPane(toolBar1,toolBar2);
// AnchorPane ap1 =new AnchorPane(toolBar1);
AnchorPane.setTopAnchor(toolBar1, 10.0);
// AnchorPane.setLeftAnchor(toolBar3, 10.0);
AnchorPane.setBottomAnchor(toolBar2, 10.0);
AnchorPane.setRightAnchor(toolBar2, 10.0);
AnchorPane ap3 =new AnchorPane();

primaryStage.setTitle("Pane HBox Examples");

Scene scene = new Scene(ap3,800,600);

public static void main(String[] args) {

runtime displays: