Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/336.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我所有的JavaFX文本字段中都有行_Java_Javafx_Textbox - Fatal编程技术网

我所有的JavaFX文本字段中都有行

我所有的JavaFX文本字段中都有行,java,javafx,textbox,Java,Javafx,Textbox,所以,在JavaFX上切齿,到目前为止一切进展顺利 但是,所有的文本字段都有一条横穿它们的线,从顶部开始大约是10px 不仅在我的应用程序中,在SceneBuilder应用程序中也是如此 注意,我没有使用任何显式CSS,我不知道SceneBuilder使用什么。屏幕截图来自SceneBuilder,我的屏幕看起来一模一样 所以,这是最基本的 java -version java version "1.8.0_45" Java(TM) SE Runtime Environment (build

所以,在JavaFX上切齿,到目前为止一切进展顺利

但是,所有的文本字段都有一条横穿它们的线,从顶部开始大约是10px

不仅在我的应用程序中,在SceneBuilder应用程序中也是如此

注意,我没有使用任何显式CSS,我不知道SceneBuilder使用什么。屏幕截图来自SceneBuilder,我的屏幕看起来一模一样

所以,这是最基本的

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)
在Mac OS 10.9.5上

只是好奇是否有其他人看到了这一点,并有一个建议

编辑:我下载了样本,这显然与Modena主题有关。里海主题看起来不错。下面是Modena.jar TextFields部分的屏幕截图。有趣的是,
TextArea
遇到了类似的问题,尽管不像
TextField
那样普遍

更多附录:

人们一直在吵着要这个,所以它来了。我基本上就是这么做的:使用默认的Netbeans 8.0.2 JavaFX应用程序项目。只需从网站上剪切粘贴即可

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

下面是ScenicView 8.6中ThreeDOM视图的屏幕截图,请注意以下行:

以下是使用里海主题的示例屏幕:

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

Emm。。。我不是100%确定,因为虽然我有Linux平台,但我对jvm没有影响;但我还是试着模仿(?不确定我是否成功)无论如何,我想你描述的问题可能真的与此相关

  • a) 字体
  • b) 重绘问题
您所表示的代码我做了一些修改,以显示如果组件按“某些”顺序排列,gridpanel线会发生什么情况

导入javafx.application.application;
导入javafx.geometry.Insets;
导入javafx.geometry.Pos;
导入javafx.scene.scene;
导入javafx.scene.control.Button;
导入javafx.scene.control.Label;
导入javafx.scene.control.TextField;
导入javafx.scene.layout.GridPane;
导入javafx.scene.layout.HBox;
导入javafx.scene.text.Font;
导入javafx.scene.text.FontWeight;
导入javafx.scene.text.text;
导入javafx.stage.stage;
公共类BlackLineIssueJavaFXApplication1扩展应用程序{
@凌驾
公共无效开始(阶段primaryStage){
System.setProperty(“javafx.userAgentStylesheetUrl”、“Modena”);
//里海摩德纳
setTitle(“JavaFX欢迎”);
GridPane grid=新建GridPane();
网格设置对齐(位置中心);
网格。setHgap(10);
网格设置间隙(10);
网格设置填充(新插图(25,25,25,25));
//setGridLinesVisible(false);//这是一个

问题似乎在于,它对开发人员来说是不可复制的

在错误报告的注释中,建议使用jvm参数:

-Dprism.disableRegionCaching=true
但是,如果有人能够复制这种非常罕见的错误,我的建议是:

  • 修改modena css文件,直到错误被解决并共享该信息。这可能会有所帮助,因为caspian似乎可以工作
  • 如果有必要,调试javafx源代码以隔离问题。但是,问题可能会更严重,但值得一试

任何有趣的CSS?看起来像是出于某种原因画出了上升线。奇怪。当你看到它时是什么样子?好吧,那真的很奇怪。你是如何设置你的应用程序的?任何明确的设置?也许你可以提供一些代码?这样我们可以看看它…(或者尝试在自己的机器上重现这个问题)
    System.setProperty("javafx.userAgentStylesheetUrl", "caspian");
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);
    }

}
-Dprism.disableRegionCaching=true