Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8112825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:38:24+00:00 2026-06-06T02:38:24+00:00

In my application I am using a MenuButton to provide a drop down list

  • 0

In my application I am using a MenuButton to provide a drop down list of actions. The default drop down indicator on a MenuButton is a black triangle pointing down. I want to change that to a white triangle pointing down to match the color of my text.

Just in case I am not being clear, here is a screen shot that should clear it up.

black triangle

I have tried placing a graphic in the fxml file like so:

<MenuButton contentDisplay="RIGHT" graphicTextGap="10.0" layoutX="92.0" layoutY="73.0" mnemonicParsing="false" styleClass="toolbar-button" text="MenuButton">
  <graphic>
    <ImageView fitHeight="4.0" fitWidth="7.0" mouseTransparent="true" preserveRatio="true">
      <image>
        <Image url="@Arrow_Down.png" preserveRatio="true" smooth="false" />
      </image>
    </ImageView>
  </graphic>
  <items>
    <MenuItem mnemonicParsing="false" text="Action 1" />
    <MenuItem mnemonicParsing="false" text="Action 2" />
  </items>
</MenuButton>

but that gives me both a black and white triangle:

white and black triangle

If I could somehow hide the black triangle that would work, but it sure seems like there should be a way to style the menu button for it to be white instead.

Here is Sample.fxml for those wanting to help:

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

<?import java.lang.*?>
<?import java.net.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>

<AnchorPane id="AnchorPane" prefHeight="200.0" prefWidth="320.0" xmlns:fx="http://javafx.com/fxml">
  <children>
    <MenuButton contentDisplay="RIGHT" graphicTextGap="10.0" layoutX="92.0" layoutY="73.0" mnemonicParsing="false" styleClass="toolbar-button" text="MenuButton">
      <graphic>
        <ImageView fitHeight="4.0" fitWidth="7.0" mouseTransparent="true" preserveRatio="true">
          <image>
            <Image url="@Arrow_Down.png" preserveRatio="true" smooth="false" />
          </image>
        </ImageView>
      </graphic>
      <items>
        <MenuItem mnemonicParsing="false" text="Action 1" />
        <MenuItem mnemonicParsing="false" text="Action 2" />
      </items>
    </MenuButton>
  </children>
  <stylesheets>
    <URL value="@test.css" />
  </stylesheets>
</AnchorPane>

The test.css:

root { 
    display: block;
}

.toolbar-button {
    -fx-background-color: #006699;
    -fx-padding: 2 4 4 4;
    -fx-text-base-color: #FFFFFF;
    -fx-font-weight: bold;
    -fx-font-size: 12px;
}

.toolbar-button:hover {
    -fx-background-color: #B2E1FF;
    -fx-padding: 2 4 4 4;
    -fx-text-base-color: #000000;
    -fx-font-weight: bold;
    -fx-font-size: 12px;
}

And the Test.java to run it:

package test;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class Test extends Application {

    public static void main(String[] args) {
        Application.launch(Test.class, args);
    }

    @Override
    public void start(Stage stage) throws Exception {
        Parent root = FXMLLoader.load(getClass().getResource("Sample.fxml"));

        stage.setScene(new Scene(root));
        stage.show();
    }
}

So how do I make the black triangle a white triangle?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T02:38:26+00:00Added an answer on June 6, 2026 at 2:38 am

    After some digging I found the answer. Turns out MenuButton does not use an image for the button but instead us -fx-shape css property to do this. In the caspian.css file it is applied in the .menu-button .arrow and .menu-button:openvertically .arrow sections. Since I was already applying the toolbar-button to my MenuButton, I simply added the following to the my css file:

    .toolbar-button .arrow {
        -fx-background-insets: 1 0 -1 0, 0;
        -fx-background-color: -fx-mark-color, #FFFFFF;
        -fx-padding: 0.25em; /* 3 */
        -fx-shape: "M 0 -3.5 v 7 l 4 -3.5 z";
    }
    
    .toolbar-button:hover .arrow {
        -fx-background-insets: 1 0 -1 0, 0;
        -fx-background-color: -fx-mark-highlight-color, -fx-mark-color;
        -fx-padding: 0.25em; /* 3 */
        -fx-shape: "M 0 -3.5 v 7 l 4 -3.5 z";
    }
    
    .toolbar-button:openvertically .arrow {
        -fx-padding: 0.166667em 0.333333em 0.166667em 0.333333em; /* 2 4 2 4 */
        -fx-shape: "M 0 0 h 7 l -3.5 4 z";
    }
    

    Which even allows me to change the color of the arrow back to black on hover.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building web application using Spring MVC Spring Security Hibenate MySQl I want
I am developing an application using TabHost. I am using android default back button
I have created an application using Netbeans 6.9. In the application I want that
I have a web application using ASP.NET 2.0 and I want to know if
I wrote an application using the Qt SDK on Windows. I now want to
I am developing an application using opencv as my college project, it's almost done
While developing an application using gwt in ecliplse crashed. Now the server is running
I creating a web application using JSF,Hibernate,Spring. I have added a filter for checking
I publish my web application using msbuild by calling following command: msbuild myweb.csproj /T:Package
I'm building my application using PhoneGap Build and all builds are ok with the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.