Java Code Examples for javafx.scene.text.Text#setLayoutY()

The following examples show how to use javafx.scene.text.Text#setLayoutY() . 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: HTMLEditorSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public static Node createIconContent() {

        Text htmlStart = new Text("<html>");
        Text htmlEnd = new Text("</html>");
        htmlStart.setFont(Font.font(null, FontWeight.BOLD, 20));
        htmlStart.setStyle("-fx-font-size: 20px;");
        htmlStart.setTextOrigin(VPos.TOP);
        htmlStart.setLayoutY(11);
        htmlStart.setLayoutX(20);

        htmlEnd.setFont(Font.font(null, FontWeight.BOLD, 20));
        htmlEnd.setStyle("-fx-font-size: 20px;");
        htmlEnd.setTextOrigin(VPos.TOP);
        htmlEnd.setLayoutY(31);
        htmlEnd.setLayoutX(20);

        return new Group(htmlStart, htmlEnd);
    }
 
Example 2
Source File: StringBindingSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public static Node createIconContent() {
    Text text = new Text("abc");
    text.setTextOrigin(VPos.TOP);
    text.setLayoutX(10);
    text.setLayoutY(11);
    text.setFill(Color.BLACK);
    text.setOpacity(0.5);
    text.setFont(Font.font(null, FontWeight.BOLD, 20));
    text.setStyle("-fx-font-size: 20px;");

    Text text2 = new Text("abc");
    text2.setTextOrigin(VPos.TOP);
    text2.setLayoutX(28);
    text2.setLayoutY(51);
    text2.setFill(Color.BLACK);
    text2.setFont(javafx.scene.text.Font.font(null, FontWeight.BOLD, 20));
    text2.setStyle("-fx-font-size: 20px;");
            
    Line line = new Line(30, 32, 45, 57);
    line.setStroke(Color.DARKMAGENTA);

    return new javafx.scene.Group(text, line, text2);
}
 
Example 3
Source File: StringBindingSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public static Node createIconContent() {
    Text text = new Text("abc");
    text.setTextOrigin(VPos.TOP);
    text.setLayoutX(10);
    text.setLayoutY(11);
    text.setFill(Color.BLACK);
    text.setOpacity(0.5);
    text.setFont(Font.font(null, FontWeight.BOLD, 20));
    text.setStyle("-fx-font-size: 20px;");

    Text text2 = new Text("abc");
    text2.setTextOrigin(VPos.TOP);
    text2.setLayoutX(28);
    text2.setLayoutY(51);
    text2.setFill(Color.BLACK);
    text2.setFont(javafx.scene.text.Font.font(null, FontWeight.BOLD, 20));
    text2.setStyle("-fx-font-size: 20px;");
            
    Line line = new Line(30, 32, 45, 57);
    line.setStroke(Color.DARKMAGENTA);

    return new javafx.scene.Group(text, line, text2);
}
 
Example 4
Source File: HTMLEditorSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public static Node createIconContent() {

        Text htmlStart = new Text("<html>");
        Text htmlEnd = new Text("</html>");
        htmlStart.setFont(Font.font(null, FontWeight.BOLD, 20));
        htmlStart.setStyle("-fx-font-size: 20px;");
        htmlStart.setTextOrigin(VPos.TOP);
        htmlStart.setLayoutY(11);
        htmlStart.setLayoutX(20);

        htmlEnd.setFont(Font.font(null, FontWeight.BOLD, 20));
        htmlEnd.setStyle("-fx-font-size: 20px;");
        htmlEnd.setTextOrigin(VPos.TOP);
        htmlEnd.setLayoutY(31);
        htmlEnd.setLayoutX(20);

        return new Group(htmlStart, htmlEnd);
    }
 
Example 5
Source File: KeyStrokeMotion.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public LettersPane() {
    setId("LettersPane");
    setPrefSize(480,480);
    setFocusTraversable(true);
    setOnMousePressed(new EventHandler<MouseEvent>() {
        
        @Override public void handle(MouseEvent me) {
            requestFocus();
            me.consume();
        }
    });
    setOnKeyPressed(new EventHandler<KeyEvent>() {
        
        @Override public void handle(KeyEvent ke) {
            createLetter(ke.getText());
            ke.consume();
        }
    });
    // create press keys text
    pressText = new Text("Press Keys");
    pressText.setTextOrigin(VPos.TOP);
    pressText.setFont(new Font(Font.getDefault().getFamily(), 40));
    pressText.setLayoutY(5);
    pressText.setFill(Color.rgb(80, 80, 80));
    DropShadow effect = new DropShadow();
    effect.setRadius(0);
    effect.setOffsetY(1);
    effect.setColor(Color.WHITE);
    pressText.setEffect(effect);
    getChildren().add(pressText);
}
 
Example 6
Source File: StopWatch.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Text createDot(String string) {
    Text text = new Text(string);
    text.setFill(Color.web("#000000"));
    text.setFont(FONT);
    text.setTextOrigin(VPos.TOP);
    text.setLayoutX(1);
    text.setLayoutY(-4);
    return text;
}
 
Example 7
Source File: StopWatch.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Text createNumber(String number, double layoutX, double layoutY) {
    Text text = new Text(number);
    text.setLayoutX(layoutX);
    text.setLayoutY(layoutY);
    text.setTextAlignment(TextAlignment.CENTER);
    text.setFill(FILL_COLOR);
    text.setFont(NUMBER_FONT);
    return text;
}
 
Example 8
Source File: CustomNodeSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public static Node createIconContent() {
    MyEnsembleNode myNode = new MyEnsembleNode("MyNode");
    myNode.setLayoutY(50);
    MyEnsembleNode parent = new MyEnsembleNode("Parent");
    Polygon arrow = createUMLArrow();
    arrow.setLayoutY(20);
    arrow.setLayoutX(25-7.5);
    Text text = new Text("<<extends>>");
    text.setTextOrigin(VPos.TOP);
    text.setLayoutY(31);
    text.setLayoutX(30);
    return new Group(parent, arrow, text, myNode);
}
 
Example 9
Source File: CustomNodeSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public MyEnsembleNode(String name) {
  text = new Text(name);
  text.setTextOrigin(VPos.TOP);
  text.setLayoutX(4);
  text.setLayoutY(2);
  rectangle = new Rectangle(50, 20, Color.WHITESMOKE);
  rectangle.setStroke(Color.BLACK);
  //add nodes as childrens, order matters, first is on the bottom
  getChildren().addAll(rectangle, text);
}
 
Example 10
Source File: KeyStrokeMotion.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public LettersPane() {
    setId("LettersPane");
    setPrefSize(480,480);
    setFocusTraversable(true);
    setOnMousePressed(new EventHandler<MouseEvent>() {
        
        @Override public void handle(MouseEvent me) {
            requestFocus();
            me.consume();
        }
    });
    setOnKeyPressed(new EventHandler<KeyEvent>() {
        
        @Override public void handle(KeyEvent ke) {
            createLetter(ke.getText());
            ke.consume();
        }
    });
    // create press keys text
    pressText = new Text("Press Keys");
    pressText.setTextOrigin(VPos.TOP);
    pressText.setFont(new Font(Font.getDefault().getFamily(), 40));
    pressText.setLayoutY(5);
    pressText.setFill(Color.rgb(80, 80, 80));
    DropShadow effect = new DropShadow();
    effect.setRadius(0);
    effect.setOffsetY(1);
    effect.setColor(Color.WHITE);
    pressText.setEffect(effect);
    getChildren().add(pressText);
}
 
Example 11
Source File: StopWatchSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private Text createDot(String string) {
    Text text = new Text(string);
    text.setFill(Color.web("#000000"));
    text.setFont(FONT);
    text.setTextOrigin(VPos.TOP);
    text.setLayoutX(1);
    text.setLayoutY(-4);
    return text;
}
 
Example 12
Source File: StopWatchSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private Text createNumber(String number, double layoutX, double layoutY) {
    Text text = new Text(number);
    text.setLayoutX(layoutX);
    text.setLayoutY(layoutY);
    text.setTextAlignment(TextAlignment.CENTER);
    text.setFill(FILL_COLOR);
    text.setFont(NUMBER_FONT);
    return text;
}
 
Example 13
Source File: CustomNodeSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public static Node createIconContent() {
    MyEnsembleNode myNode = new MyEnsembleNode("MyNode");
    myNode.setLayoutY(50);
    MyEnsembleNode parent = new MyEnsembleNode("Parent");
    Polygon arrow = createUMLArrow();
    arrow.setLayoutY(20);
    arrow.setLayoutX(25-7.5);
    Text text = new Text("<<extends>>");
    text.setTextOrigin(VPos.TOP);
    text.setLayoutY(31);
    text.setLayoutX(30);
    return new Group(parent, arrow, text, myNode);
}
 
Example 14
Source File: CustomNodeSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public MyEnsembleNode(String name) {
  text = new Text(name);
  text.setTextOrigin(VPos.TOP);
  text.setLayoutX(4);
  text.setLayoutY(2);
  rectangle = new Rectangle(50, 20, Color.WHITESMOKE);
  rectangle.setStroke(Color.BLACK);
  //add nodes as childrens, order matters, first is on the bottom
  getChildren().addAll(rectangle, text);
}
 
Example 15
Source File: KeyStrokeMotion.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public LettersPane() {
    setId("LettersPane");
    setPrefSize(480,480);
    setFocusTraversable(true);
    setOnMousePressed(new EventHandler<MouseEvent>() {
        
        @Override public void handle(MouseEvent me) {
            requestFocus();
            me.consume();
        }
    });
    setOnKeyPressed(new EventHandler<KeyEvent>() {
        
        @Override public void handle(KeyEvent ke) {
            createLetter(ke.getText());
            ke.consume();
        }
    });
    // create press keys text
    pressText = new Text("Press Keys");
    pressText.setTextOrigin(VPos.TOP);
    pressText.setFont(new Font(Font.getDefault().getFamily(), 40));
    pressText.setLayoutY(5);
    pressText.setFill(Color.rgb(80, 80, 80));
    DropShadow effect = new DropShadow();
    effect.setRadius(0);
    effect.setOffsetY(1);
    effect.setColor(Color.WHITE);
    pressText.setEffect(effect);
    getChildren().add(pressText);
}
 
Example 16
Source File: StopWatchSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private Text createDot(String string) {
    Text text = new Text(string);
    text.setFill(Color.web("#000000"));
    text.setFont(FONT);
    text.setTextOrigin(VPos.TOP);
    text.setLayoutX(1);
    text.setLayoutY(-4);
    return text;
}
 
Example 17
Source File: StopWatchSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private Text createNumber(String number, double layoutX, double layoutY) {
    Text text = new Text(number);
    text.setLayoutX(layoutX);
    text.setLayoutY(layoutY);
    text.setTextAlignment(TextAlignment.CENTER);
    text.setFill(FILL_COLOR);
    text.setFont(NUMBER_FONT);
    return text;
}
 
Example 18
Source File: LedView.java    From ARMStrong with Mozilla Public License 2.0 4 votes vote down vote up
/**
 * Creates a new instance of Node
 * @param simulator the arm simulator
 */
public LedView(ArmSimulator simulator){

    this.simulator = simulator;

    this.mainPane = new ScrollPane();
    
    ledOff = new Image(getClass().getResource("/resources/ledOff.png").toExternalForm());
    ledOn = new Image(getClass().getResource("/resources/ledOn.png").toExternalForm());
    leverOff = new Image(getClass().getResource("/resources/leverOff.png").toExternalForm());
    leverOn = new Image(getClass().getResource("/resources/leverOn.png").toExternalForm()); 
      
    gameContainer = new HBox();
    ledContainer = new VBox();
    buttonContainer = new VBox();
            
    for(int i=0 ; i < 8 ; i++) { //creating 8 leds at the start of the view
    	IOLed led = simulator.newIOLed();
    	
    	AnchorPane newLedAddress = new AnchorPane();
        ImageView newLedImage = new ImageView();
        
        ledArray.add(led);
    	ledImageArrayList.add(newLedImage);
    	
    	if(led.isOn()) {
        	newLedImage.setImage(ledOn);
        }else {
        	newLedImage.setImage(ledOff);
        }       	

        newLedImage.setLayoutX(0);
        newLedImage.setLayoutY(0);
        Text newAddress = new Text();
        newAddress.setText("0x" + Long.toHexString(led.getPortAddress()) + " Bit N°" + led.shift);
        newAddress.setLayoutX(95);
        newAddress.setLayoutY(55);
        
        newLedAddress.getChildren().addAll(newLedImage, newAddress);
        ledContainer.getChildren().add(newLedAddress);
    }
    
    for(int i=0 ; i < 2 ; i++) { //creating 3 buttons at the start of the view
    	IOButton IOpressButton = simulator.newIOButton();
    	IOSwitch IOleverButton = simulator.newIOSwitch();
    	AnchorPane buttonAndTextAndLeverAndTextAnchorPane = new AnchorPane();
    	       	
    	Text leverText = new Text();
    	leverText.setText("0x" + Long.toHexString(IOpressButton.getPortAddress()) + " Bit N°" + IOpressButton.shift);
    	leverText.setLayoutX(30);
        leverText.setLayoutY(100);

        Text pushingText = new Text();
        pushingText.setText("0x" + Long.toHexString(IOleverButton.getPortAddress()) + " Bit N°" + IOleverButton.shift);
        pushingText.setLayoutX(30);
        pushingText.setLayoutY(190);
        
        ImageView lever = new ImageView(leverOff);            
    	Button leverButton =  new Button("", lever);
    	Button pushingButton = new Button("", new ImageView(new Image(getClass().getResource("/resources/pushingButton.png").toExternalForm())));

    	leverButton.setOnAction(ActionEvent -> {
    		IOleverButton.flip();       
    		refresh();
        });
    	
    	pushingButton.setOnAction(ActionEvent -> {
    		IOpressButton.push();     
    		refresh();
        });


    	leverButton.setLayoutX(70);
        leverButton.setLayoutY(25);
    	pushingButton.setLayoutX(70);
        pushingButton.setLayoutY(115);        
        
    	leverButtonArray.add(IOleverButton);
    	pressButtonArray.add(IOpressButton);
    	leverImageArrayList.add(lever);
    	
    	buttonAndTextAndLeverAndTextAnchorPane.getChildren().addAll(leverButton, leverText, pushingButton, pushingText);
    	buttonContainer.getChildren().add(buttonAndTextAndLeverAndTextAnchorPane);
    }
    
    gameContainer.getChildren().addAll(ledContainer, buttonContainer);
    
    this.dockNode = new DockNode(mainPane, "Led Game", new ImageView(dockImage));
    
    dockNode.setPrefSize(300,666);
    
    this.mainPane.setContent(gameContainer);  
    this.mainPane.setFitToWidth(true);
    this.mainPane.setFitToHeight(true);  
    this.mainPane.setHmin(dockNode.getHeight());
}