Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

274
Views
JavaFX Node partial border

Having a Node for example VBox I am trying to add a border and there are 2 ways I can think of - using css or using new Border () etc..

How can I remove part of the border ? i.e remove the bottom part of the border

about 4 years ago · Santiago Trujillo
3 answers
Answer question

0

You can specify different styles for the borders on different sides

Using Border

@Override
public void start(Stage primaryStage) {
    Region root = new Region();
    root.setBorder(new Border(new BorderStroke(Color.RED, Color.RED, Color.RED, Color.RED,
            BorderStrokeStyle.SOLID, BorderStrokeStyle.SOLID, BorderStrokeStyle.NONE, BorderStrokeStyle.SOLID,
            CornerRadii.EMPTY, new BorderWidths(5), Insets.EMPTY)));

    Scene scene = new Scene(root, 300, 300);

    primaryStage.setScene(scene);
    primaryStage.show();
}

Using inline css

root.setStyle("-fx-border-style: solid solid none solid; -fx-border-width: 5; -fx-border-color: red;");

Using a css stylesheet

.root { /* modify the selector according to your needs */
    -fx-border-style: solid solid none solid;
    -fx-border-width: 5;
    -fx-border-color: red;
}
about 4 years ago · Santiago Trujillo Report

0

none doesnt work on javafx 13. I tried changing it to hidden and it works.

.root { /* modify the selector according to your needs */
    -fx-border-style: solid solid hidden solid;
    -fx-border-width: 5;
    -fx-border-color: red;
}
about 4 years ago · Santiago Trujillo Report

0

Setting border-width to 0 worked (JavaFX 17): Example:

#header
{
    -fx-border-width: 0 0 2px 0;
    -fx-border-color: black;
    -fx-border-style: solid;
}

Here you can get border only at bottom - order: Top, right, bottom, left.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!