Scale button text to button size (not vice versa)

I have a simple alert shown below that is displayed differently in Windows and Linux. There are quite a bit of posts to scale button size depending on text but I essentially want the opposite. The Buttons should stay the same size and the text should scale to fit (like it appears to be doing in windows)

protected static void setDifficulty(){

    Alert alert = new Alert(AlertType.CONFIRMATION);
    alert.setTitle("Welcome to the game of Memory");
    alert.setHeaderText("How difficult should your oppenent be?");
    alert.setContentText("Please choose your desired difficulty.");

    ButtonType button1 = new ButtonType("Nice n' Easy");
    ButtonType button2 = new ButtonType("So So");
    ButtonType button3 = new ButtonType("Super Freak");
    ButtonType buttonCancel = new ButtonType("Cancel", ButtonData.CANCEL_CLOSE);

    alert.getButtonTypes().setAll(button1, button2, button3, buttonCancel);

    Optional<ButtonType> result = alert.showAndWait();
    if (result.get() == button1){
        MemoryField.difficulty = 10;
    } else if (result.get() == button2) {
        MemoryField.difficulty = 5;
    } else if (result.get() == button3) {
        MemoryField.difficulty = 0;
    } else {

In Windows:

In Ubuntu:

Source: windows

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.