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

Unable to clear border on TextField using CSS

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • fx2.0
    • javafx

      I am unable to clear the border on a TextField using CSS. When I set a border it seems to add my border to the default ones - I can find no way to turn off the default one.

      Discussed on the forum here: https://forums.oracle.com/forums/thread.jspa?threadID=2280232

      I have tried the following:

      public class TestApp extends Application
      {
          public static void main(String[] args) throws Exception
          {
              launch(args);
          }
       
          public void start(Stage stage) throws Exception
          {
              Pane root = new FlowPane(4, 4);
       
              TextField textField1 = new TextField();
              textField1.setStyle("-fx-border-width: 2; -fx-border-color: green;");
              root.getChildren().add(textField1);
       
              TextField textField2 = new TextField();
              textField2.setStyle("-fx-border-width: 0;");
              root.getChildren().add(textField2);
       
              TextField textField3 = new TextField();
              textField3.setStyle("-fx-border-style: none;");
              root.getChildren().add(textField3);
       
              stage.setScene(new Scene(root, 600, 300));
              stage.show();
          }
      }

      My expectation is that by setting a border on the TextField, the default one will not show.

      Cheers,
      zonski

            leifs Leif Samuelsson (Inactive)
            dzwolenskjfx Daniel Zwolenski (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: