import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TitledPane;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Font;
import javafx.stage.Stage;

public class HeightIssue
{

    public static void main( String[] args )
    {
        System.err.println( Runtime.version().toString() );
        Application.launch( HeightIssue.MainFx.class, args );
    }

    public static class MainFx extends Application
    {

        @Override
        public void start( final Stage primaryStage ) throws Exception
        {
            final TitledPane left = new TitledPane( "Small font", createButton( 10) );
            final TitledPane right =
                new TitledPane( "Big font", createButton( 20) );
            final HBox hBox = new HBox( 5, left, right );
            final BorderPane borderPane = new BorderPane( hBox );
            borderPane.setPadding( new Insets( 5 ) );
            Scene scene = new Scene( borderPane, 800, 600 );
            primaryStage.setScene( scene );
            primaryStage.show();
        }

        private static Button createButton( double aFontSize )
        {
            final Button button = new Button( );
            button.setGraphic( new Rectangle( 5,5, Color.RED) );
            button.setFont( Font.font( aFontSize ) );
            return button;
        }
    }

}
