java swing rectangle border thickness code example Example: javafx rectangle border size rectangle.setStrokeWidth(width);