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

javafx 8 borders change size of control

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • 8
    • 8
    • javafx
    • None
    • jdk 8u77
      Mac OS X 10.8.2

      An example of this is a button that adds a border on hover through CSS. When it's hovered over, the button jumps around, I assume because the border adds to its width and height. In javafx 2.2, this didn't happen.

      My workaround is to add a transparent border of the same width on the non-hovered mode. Here is the CSS I'm using:

      .toolbarButton {
          -fx-font-family: 'FontAwesome';
          -fx-font-size: 1.1em;
          -fx-padding: 3 5 1 5;
          -fx-background-color: transparent;
          -fx-focus-traversable: false;
          -fx-text-fill: ladder(-fx-background, white 49%, black 50%);
          -fx-graphic-text-gap: 0;
      }

      .toolbarButton:hover {
          -fx-border-color: -fx-text-fill;
          -fx-border-style: solid;
          -fx-border-width: 1;
          -fx-border-radius: 3;
      }

            dgrieve David Grieve
            cstanford Curtis Stanford
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: