Program Club

내 모든 JavaFX TextField에는 줄이 있습니다.

proclub 2020. 10. 27. 23:42
반응형

내 모든 JavaFX TextField에는 줄이 있습니다.


그래서 JavaFX에서 이빨을 자르면서 지금까지 모든 것이 잘 진행되고 있습니다.

그러나 모든 텍스트 필드에는 위쪽에서 10px 정도의 줄이 있습니다.

내 응용 프로그램뿐만 아니라 SceneBuilder 응용 프로그램에서도 마찬가지입니다.

저는 명시적인 CSS를 사용하지 않으며 SceneBuilder가 무엇을 사용하는지 모릅니다. 스크린 샷은 SceneBuilder에서 가져온 것이며 내 화면은 동일하게 보입니다.

JavaFX 텍스트 필드

그래서 그것은 근본적인 것입니다.

java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

맥 OS 10.9.5

다른 사람이 이것을보고 제안이 있는지 궁금합니다.

편집 : 샘플을 다운로드했는데 모데나 테마와 분명히 관련이 있습니다. Caspian 테마는 괜찮아 보입니다. 아래는 Modena.jar TextFields 섹션의 스크린 샷입니다. TextArea.NET 파일만큼 보편적이지는 않지만 유사한 문제를 겪고 있다는 것은 흥미 롭습니다 TextField.

Modena.jar 스크린 샷

추가 사항 :

사람들은 계속 이것을 요구하고 있습니다. 나는 본질적으로 https://docs.oracle.com/javafx/2/get_started/form.htm을 따랐고 기본 Netbeans 8.0.2 JavaFX Application 프로젝트를 사용했습니다. 웹 사이트에서 잘라내어 붙여 넣기 만하면됩니다.

public class Fxlinetest extends Application {

    @Override
    public void start(Stage primaryStage) {
        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));

        Text scenetitle = new Text("Welcome");
        scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
        grid.add(scenetitle, 0, 0, 2, 1);

        Label userName = new Label("User Name:");
        grid.add(userName, 0, 1);

        TextField userTextField = new TextField();
        grid.add(userTextField, 1, 1);

        Label pw = new Label("Password:");
        grid.add(pw, 0, 2);

        PasswordField pwBox = new PasswordField();
        grid.add(pwBox, 1, 2);

        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);

        final Text actiontarget = new Text();
        grid.add(actiontarget, 1, 6);

        Scene scene = new Scene(grid, 300, 275);
        primaryStage.setScene(scene);

        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}

샘플 양식 스크린 샷

java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)

다음은 ScenicView 8.6의 ThreeDOM보기 스크린 샷입니다. ScenicView의 ThreeDOM보기-라인을 확인하세요.

java version "1.8.0_74"
Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)

다음을 통해 Caspian 테마를 사용하는 샘플 화면은 다음과 같습니다.

    System.setProperty("javafx.userAgentStylesheetUrl", "caspian");

카스피 테마보기


이것은 알려진 해결되지 않은 버그 입니다.

문제는 개발자가 재현 할 수 없다는 것입니다.

버그 보고서의 주석에서 jvm 매개 변수 사용이 제안됩니다.

-Dprism.disableRegionCaching=true

그러나 누군가이 매우 드문 버그를 재현 할 수 있다면 다음과 같이 제안합니다.

  • 버그가 해결 될 때까지 modena css 파일을 수정하고 해당 정보를 공유하십시오. caspian이 작동하는 것처럼 보이기 때문에 도움이 될 수 있습니다.
  • 필요한 경우 javafx 소스로 디버그하여 문제를 분리하십시오. 그러나 문제가 더 심해질 수 있지만 한 번 시도해 볼 가치가 있습니다.

음 ... Linux 플랫폼이 있지만 내 jvm에 영향을 미치지 않기 때문에 100 % 확신 할 수 없습니다. 그러나 여전히 나는 당신이 설명하는 문제가 실제로 관련이있을 수 있다고 생각합니다.

  • a) 글꼴
  • b) 다시 칠하기 문제

여러분이 표현한 코드는 구성 요소가 "일부"순서로 배치 된 경우 그리드 패널 라인에 어떤 일이 발생하는지 보여주기 위해 약간 수정했습니다.

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);
    }

}

실행중인 앱은 다음과 같습니다.

이미지 A :

여기에 이미지 설명 입력

... 따라서 Vgap이 10으로 설정되어 있기 때문에 약 10px 거리의 텍스트 필드에 검은 선이 나타납니다. 또한 "환영"텍스트가 교차하지만 세로줄이 있음을 참조하십시오. 올바른 위치 에있는 scenetitle에 "글꼴을 사용하지 않는지"테스트 했습니다 (이미지 참조).

이미지 B

여기에 이미지 설명 입력

So something is maybe wrong with GridPane I guess; Maybe the default GridPane has "lines visible" or something but after components added the lines "disposed" but because of TextField which should contain "text" with "font" (see image A vertical lines cross text because of the font) the repaint doesn't work properly and you can see the black line at the top as image A shows; I cannot emulate the effect totally but still I may suggest where the "un-disposed" line may come from or something :)

I'll try to analyse a bit further anyways the info I describe in this answer may help you to find where to start debugging;

If you need some additional information please let me know;

Good luck :)

toolkit I used to test :

  • jdk-1.0.8_25
  • jre-1.8.0_60 (Linux x64)
  • ide : netbeans 8.0.1

참고 URL : https://stackoverflow.com/questions/30698297/all-my-javafx-textfields-have-lines-in-them

반응형