Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8122196

The graphic of a disabled button is not being rendered correctly under certain conditions


    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Cannot Reproduce
    • Affects Version/s: 7u40
    • Fix Version/s: 8
    • Component/s: javafx


      Under certain conditions, the graphic of a disabled button is not being rendered correctly: it looks like it is overlapped with another disabled button's graphic, and flickers upon resizing the Window.

      It seems to me that there are multiple factors causing this, but here's at least one scenario which reproduces the problem consistently:
      - I have three buttons in an HBox: A.disabled B.enabled C.disabled
      - The graphic of C looks overlapped with that of A, and flickers upon resizing the Window

      import javafx.application.Application;
      import javafx.beans.binding.Bindings;
      import javafx.geometry.Insets;
      import javafx.scene.Node;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.ButtonBuilder;
      import javafx.scene.control.ContentDisplay;
      import javafx.scene.control.Label;
      import javafx.scene.layout.HBox;
      import javafx.scene.layout.HBoxBuilder;
      import javafx.scene.layout.VBox;
      import javafx.scene.layout.VBoxBuilder;
      import javafx.scene.paint.Color;
      import javafx.scene.shape.CircleBuilder;
      import javafx.scene.shape.RectangleBuilder;
      import javafx.stage.Stage;

      public class DisabledGraphicTest extends Application {

          public DisabledGraphicTest() {

          public static void main(String[] args) {

          public void start(Stage stage) {
              Button goodRedButton = createButton(CircleBuilder.create().fill(Color.RED).radius(8).build());
              Button goodBlueButton = createButton(RectangleBuilder.create().fill(Color.BLUE).height(16).width(16).build());
              HBox goodHBox = HBoxBuilder.create().children(goodRedButton, goodBlueButton).spacing(10).build();
              VBox goodVBox = VBoxBuilder.create().children(new Label("With two consecutive disabled buttons: there's nothing wrong:"), goodHBox).build();

              Button badRedButton = createButton(CircleBuilder.create().fill(Color.RED).radius(8).build());
              Button badGreenButton = createButton(CircleBuilder.create().fill(Color.GREEN).radius(8).build());
              Button badBlueButton = createButton(RectangleBuilder.create().fill(Color.BLUE).height(16).width(16).build());
              HBox badHBox = HBoxBuilder.create().children(badRedButton, badGreenButton, badBlueButton).spacing(10).build();
              VBox badVBox = VBoxBuilder.create().children(new Label("But with an enbaled button in between, the graphic of the third button is not being rendered correctly:"), new Label("it sort of overlaps with that of the first button, and flickers upon resizing the Window:"), badHBox).build();

              VBox vBox = VBoxBuilder.create().children(goodVBox, badVBox).spacing(200).padding(new Insets(50)).build();

              Scene scene = new Scene(vBox);

          private Button createButton(Node graphic) {
              return ButtonBuilder.create().contentDisplay(ContentDisplay.GRAPHIC_ONLY).graphic(graphic).build();



        1. image-initial.png
          32 kB
        2. image-resize.png
          32 kB
        3. screenshot-1.jpg
          34 kB

          Issue Links



              • Assignee:
                kcr Kevin Rushforth
                sbozianjfx Shant Bozian (Inactive)
              • Votes:
                0 Vote for this issue
                4 Start watching this issue


                • Created: