Dadi_2 0 Newbie Poster

I have recently shifted from c# to try Javafx2. I am also new to this forum. I have been stuck trying to implement internal frames in Javafx. I stumbled upon this link:

I have managed to add jfxtras 8 jar file to my project as well as in scene builder 2. However, am stuck in aligning the controls on the window.

This is the fxml file code:

<?xml version="1.0" encoding="UTF-8"?>

<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<?import jfxtras.labs.scene.control.window.*?>

<AnchorPane id="AnchorPane" prefHeight="400.0" prefWidth="500.0" xmlns:fx="" xmlns="" fx:controller="trials.MamaCont">
<children><Window fx:id="wini" layoutX="122.0" layoutY="105.0" prefHeight="190.0" prefWidth="313.0" title="Window" />

and this is the controller class code:

package trials;

import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import jfxtras.labs.scene.control.window.CloseIcon;
import jfxtras.labs.scene.control.window.MinimizeIcon;
import jfxtras.labs.scene.control.window.Window;

 * FXML Controller class
 * @author smoothie
public class MamaCont implements Initializable {

     * Initializes the controller class.

    private Button pb;

    private Label lb;*/

    private Window wini;

    void pressed(ActionEvent event) {

    public void initialize(URL url, ResourceBundle rb) {
        // TODO
        wini.getLeftIcons().add(new CloseIcon(wini));
        wini.getRightIcons().add(new MinimizeIcon(wini));

        Button butt = new Button("Enter");

        Label lab = new Label();

        butt.setOnAction(new EventHandler<ActionEvent>() {

            public void handle(ActionEvent t) {
                lab.setText("I've been pressed!!!");



Now, does anyone know how I can be able to align the label so that its text appears below the button? When one clicks on the button the text from the label appears over the button instead of below it.

Has anyone been able to implement internal frames with javafx2 and could you please share how you have managed to put well arranged controls within the internal frames?

Lastly, does anyone know how to make a scene builder control a child of a custom control in scene builder?

I managed to add jfxtras controls to scene builder but unfortunately am not able to add javafx controls to the jfxtras window. In this case, I tried to add a javafx button to the jfxtras window via scene builder but it never worked because it was added to the anchor pane instead of the window resulting to the both the jfxtras window and javafx button being children of the anchor pane.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.