Umm ... I'm not 100% sure because I do not affect my jvm, although I have a Linux platform; But still, I tried to imitate ("I'm not sure that I succeeded very well), anyway, I think that the problem you are describing can really be related to
- a) font
- b) redraw the problem
The code you presented changed me a bit to show what happens to the mesh lines if the components are in “some” order;
import javafx.application.Application; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; import javafx.scene.text.Font; import javafx.scene.text.FontWeight; import javafx.scene.text.Text; import javafx.stage.Stage; public class BlackLineIssueJavaFXApplication1 extends Application { @Override public void start(Stage primaryStage) { System.setProperty("javafx.userAgentStylesheetUrl", "Modena"); //Modena,caspian primaryStage.setTitle("JavaFX Welcome"); GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); // grid.setGridLinesVisible(false);//<--- Text scenetitle = new Text("Welcome");//original // Label scenetitle = new Label("Welcome");//modified scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));//original // scenetitle.setFont(Font.font("Verdana", FontWeight.LIGHT, 30));//modified grid.add(scenetitle, 0, 0, 2, 1);//original // grid.add(scenetitle, 0, 0);//modified Label userName = new Label("User Name:");//original // Text userName = new Text("User Name:"); // userName.setFont(Font.font("Tahoma", FontWeight.NORMAL, 11)); // grid.add(userName, 0, 1);//original grid.add(userName, 0, 1,1,2);//modified grid.setGridLinesVisible(true);//<--- TextField userTextField = new TextField(); // userTextField.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));//modified userTextField.setOpacity(0.5);//<---- // grid.add(userTextField, 1, 1);//original grid.add(userTextField, 1, 1,1,2);//modified grid.setGridLinesVisible(false);//<--- Button btn = new Button("Sign in"); HBox hbBtn = new HBox(10); hbBtn.setAlignment(Pos.BOTTOM_RIGHT); hbBtn.getChildren().add(btn); grid.add(hbBtn, 1, 4);//original //grid.add(hbBtn, 1, 3);//modified final Text actiontarget = new Text(); grid.add(actiontarget, 1, 6); Scene scene = new Scene(grid, 300, 275); primaryStage.setScene(scene); primaryStage.show(); } /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } }
The launch of the application is as follows:
Image A:

... therefore a black line appears in the text field at a distance of about 10 pixels, perhaps only because Vgap is set to 10; Moreover, see the text of the "greeting" crossed, but with vertical lines; I tested if "do not use a font" for a scenetitle , it is correctly located (see. Image);
Image B

So maybe something is wrong with the GridPane. Maybe by default the GridPane has “visible lines” or something, but after the components have added “disposed” lines, but because of the TextField, which should contain “text” with a “font” (see Image. Vertical the lines cross the text due to the font), repaint doesn't work correctly, and you can see the black line at the top, as image A shows; I can not fully emulate the effect, but still I can offer where a “loose” line or something like that can occur.
I will try to analyze a little further, since the information that I describe in this answer can help you find where to start debugging;
If you need more information, please let me know;
Good luck :)
Tool
which I used for testing:
- JDK 1.0.8_25-
- jre-1.8.0_60 (Linux x64)
- ide: netbeans 8.0.1