Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/381.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
“如何调试错误”;[75,0]JavaFx CSS的预期LBRACE;_Java_Css_Javafx - Fatal编程技术网

“如何调试错误”;[75,0]JavaFx CSS的预期LBRACE;

“如何调试错误”;[75,0]JavaFx CSS的预期LBRACE;,java,css,javafx,Java,Css,Javafx,我不知道为什么会出现这个错误。每一行我都检查了好几次 com.sun.javafx.css.parser.CSSParser parse 警告:CSS错误解析文件:/C:/Users/rmanassya/Desktop/BinaryNameV1.1/BinaryNameV1.1/BinaryName/bin/style.CSS:LBRACE应为[75,0] 我的CSS .center-text-area *.text { -fx-text-alignment: center; } #top-r

我不知道为什么会出现这个错误。每一行我都检查了好几次

com.sun.javafx.css.parser.CSSParser parse 警告:CSS错误解析文件:/C:/Users/rmanassya/Desktop/BinaryNameV1.1/BinaryNameV1.1/BinaryName/bin/style.CSS:LBRACE应为[75,0]

我的CSS

.center-text-area *.text {
-fx-text-alignment: center;
}

#top-radius{
-fx-border-radius: 50 50 0 0;
-fx-background-radius: 50 50 0 0;
}

#ipad-grey {
-fx-background-color: 
    linear-gradient(#686868 0%, #232723 25%, #373837 75%, #757575 100%),
    linear-gradient(#020b02, #3a3a3a),
    linear-gradient(#b9b9b9 0%, #c2c2c2 20%, #afafaf 80%, #c8c8c8 100%),
    linear-gradient(#f5f5f5 0%, #dbdbdb 50%, #cacaca 51%, #d7d7d7 100%);
-fx-background-insets: 0,1,4,5;
-fx-background-radius: 9,8,5,4;
-fx-padding: 15 30 15 30;
-fx-font-family: "Arial Rounded MT Bold";
-fx-font-size: 30px;
-fx-font-weight: bold;
-fx-text-fill: #333333;
-fx-effect: dropshadow( three-pass-box , rgba(255,255,255,0.2) , 1, 0.0 , 0 
, 1);
margin: 100px;
-fx-pref-width: 300px;
}

#ipad-grey Text {
-fx-effect: dropshadow( one-pass-box , white , 0, 0.0 , 0 , 1 );
}

#shiny-orange{
-fx-background-color: 
    linear-gradient(#ffd65b, #e68400),
    linear-gradient(#ffef84, #f2ba44),
    linear-gradient(#ffea6a, #efaa22),
    linear-gradient(#ffe657 0%, #f8c202 50%, #eea10b 100%),
    linear-gradient(from 0% 0% to 15% 50%, rgba(255,255,255,0.9), 
rgba(255,255,255,0));
-fx-background-radius: 30;
-fx-background-insets: 0,1,2,3,0;
-fx-text-fill: #333333;
-fx-font-weight: bold;
-fx-font-size: 30px;
-fx-padding: 10 20 10 20;
-fx-pref-width: 700px;
}

#shiny-orange-reset{
-fx-background-color: 
    linear-gradient(#ffd65b, #e68400),
    linear-gradient(#ffef84, #f2ba44),
    linear-gradient(#ffea6a, #efaa22),
    linear-gradient(#ffe657 0%, #f8c202 50%, #eea10b 100%),
    linear-gradient(from 0% 0% to 15% 50%, rgba(255,255,255,0.9), 
rgba(255,255,255,0));
-fx-background-radius: 30;
-fx-background-insets: 0,1,2,3,0;
-fx-text-fill: #333333;
-fx-font-weight: bold;
-fx-font-size: 30px;
-fx-padding: 10 20 10 20;
-fx-pref-width: 300px;
}

.button-pressed:pressed{
-fx-background-color: gray;
}

#CMHlogo {
-fx-background-image: url("codinghangout_logos_green.png");
-fx-background-repeat: no-repeat;   
-fx-background-size: 270 190;
-fx-background-position: top left;
} 
JavaFx代码

public class Main extends Application {

public static void main1(String[] args) {  

    if (args.length == 0) {  
        try {  
            // re-launch the app itselft with VM option passed  
            Runtime.getRuntime().exec(new String[] {"java", "-
Dcom.sun.javafx.isEmbedded-true", "-Dcom.sun.javafx.touch=true", "-
Dcom.sun.javafx.virtualKeyboard=javafx", "-jar", "BinaryName1.jar"});  
        } catch (IOException ioe) {  
            ioe.printStackTrace();  
        }  
        System.exit(0);  
    }  

    // Run the main program with the VM option set  
    //...  
    //...  
}  

private ConversionController conversionController = new 
ConversionController();

private PopupWindow keyboard;

private final Rectangle2D visualBounds = 
Screen.getPrimary().getVisualBounds();
private final Rectangle2D bounds = Screen.getPrimary().getBounds();
private final double taskbarHeight = bounds.getHeight() - 
visualBounds.getHeight();

@Override
public void start(Stage primaryStage) throws Exception {

    primaryStage.setTitle("Binary Name");

    Label helloLbl = new Label("Hello");
    helloLbl.setAlignment(Pos.CENTER);
    helloLbl.setFont(Font.font("Comic Sans MS", FontWeight.BOLD, 68));
    helloLbl.setStyle("-fx-background-color: red;padding: 20px;");
    helloLbl.setTextFill(Color.web("#ffffff"));



    Label myNameLbl = new Label("my name is");
    myNameLbl.setAlignment(Pos.CENTER);
    myNameLbl.setFont(Font.font("Comic Sans MS", 48));
    myNameLbl.setStyle("-fx-background-color: red;padding: 20px;");
    myNameLbl.setTextFill(Color.web("#ffffff"));

    VBox logoBox = new VBox(10);
    logoBox.setId("CMHlogo");
    logoBox.getChildren().addAll(helloLbl, myNameLbl);
    logoBox.setAlignment(Pos.CENTER);



    TextArea nameTxtArea = new TextArea();
    nameTxtArea.setWrapText(Boolean.TRUE);
    nameTxtArea.getStyleClass().add("center-text-area");
    nameTxtArea.setFont(Font.font("Comic Sans MS", 28));
    nameTxtArea.setStyle("padding: 40px;");


    Label dummy = new Label(" ");
    dummy.setStyle("-fx-background-color: red;");
    dummy.setFont(Font.font("Comic Sans MS", FontWeight.BOLD, 30));

    /**Button printBtn = new Button("PRINT");
    printBtn.setId("ipad-grey");
    printBtn.setDisable(Boolean.TRUE);*/

    Button convertBtn = new Button("Check Your Answer/Revisa Tu Respuesta");
    convertBtn.setId("shiny-orange");

    convertBtn.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {

 nameTxtArea.setText(conversionController.getBinaryName
 (nameTxtArea.getText()));
            convertBtn.setDisable(Boolean.TRUE);
            //printBtn.setDisable(Boolean.FALSE);
            nameTxtArea.requestFocus();
        }
    });

    Button resetBtn = new Button("RESET");
    resetBtn.setId("shiny-orange-reset");
    resetBtn.getStyleClass().add("button-pressed");
    resetBtn.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            // Reset
            nameTxtArea.setText("");
            convertBtn.setDisable(Boolean.FALSE);
            //printBtn.setDisable(Boolean.TRUE);
            nameTxtArea.requestFocus();
        }

    });

    HBox hBox = new HBox(100);
    hBox.setAlignment(Pos.CENTER);
    hBox.getChildren().addAll(convertBtn); // add printBtn next to 
convertBtn, 

    VBox vBox = new VBox(10);
    vBox.setAlignment(Pos.TOP_CENTER);
    vBox.getChildren().addAll(logoBox, nameTxtArea, dummy, hBox, resetBtn);
    vBox.setStyle("-fx-background-color: red;margin: 20px;");
    vBox.setId("top-radius");
public类主扩展应用程序{
公共静态void main1(字符串[]args){
如果(args.length==0){
试试{
//通过VM选项重新启动应用程序本身
Runtime.getRuntime().exec(新字符串[]{“java”,”-
Dcom.sun.javafx.isEmbedded true“,”-Dcom.sun.javafx.touch=true“,”-
Dcom.sun.javafx.virtualKeyboard=javafx“,“-jar”,“BinaryName1.jar”});
}捕获(ioe异常ioe){
ioe.printStackTrace();
}  
系统出口(0);
}  
//在设置VM选项的情况下运行主程序
//...  
//...  
}  
私有转换控制器ConversionController=new
转换控制器();
专用弹出窗口键盘;
私有最终矩形2D可视边界=
Screen.getPrimary().getVisualBounds();
私有最终矩形2D边界=Screen.getPrimary().getBounds();
private final double taskbarHeight=bounds.getHeight()
visualBounds.getHeight();
@凌驾
public void start(Stage primaryStage)引发异常{
primaryStage.setTitle(“二进制名称”);
标签helloLbl=新标签(“你好”);
helloLbl.设置对齐(位置中心);
helloLbl.setFont(Font.Font(“Comic Sans MS”,fontwweight.BOLD,68));
helloLbl.setStyle(“-fx背景色:红色;填充:20px;”);
helloLbl.setTextFill(Color.web(“#ffffff”);
Label myNameLbl=新标签(“我的名字是”);
myNameLbl.设置对齐(位置中心);
myNameLbl.setFont(Font.Font(“Comic Sans MS”,48));
myNameLbl.setStyle(“-fx背景色:红色;填充:20px;”);
myNameLbl.setTextFill(Color.web(“#ffffff”);
VBox标识框=新的VBox(10);
logoBox.setId(“CMHlogo”);
logoBox.getChildren().addAll(helloLbl,myNameLbl);
标识箱。设置校准(位置中心);
TextArea name txtarea=新建TextArea();
nameTxtArea.setWrapText(Boolean.TRUE);
nameTxtArea.getStyleClass().add(“中间文本区域”);
nameTxtArea.setFont(Font.Font(“Comic Sans MS”,28));
nameTxtArea.setStyle(“padding:40px;”);
标签虚拟=新标签(“”);
dummy.setStyle(“-fx背景色:红色;”);
dummy.setFont(Font.Font(“Comic Sans MS”,fontwweight.BOLD,30));
/**按钮打印BTN=新按钮(“打印”);
printBtn.setId(“ipad灰色”);
printbn.setDisable(Boolean.TRUE)*/
Button convertBtn=新按钮(“检查您的答案/修改您的回答”);
convertBtn.setId(“亮橙色”);
convertBtn.setOnAction(新的EventHandler(){
@凌驾
公共无效句柄(ActionEvent事件){
nameTxtArea.setText(conversionController.getBinaryName
(nameTxtArea.getText());
convertbn.setDisable(Boolean.TRUE);
//printbn.setDisable(Boolean.FALSE);
nameTxtArea.requestFocus();
}
});
按钮重置Btn=新按钮(“重置”);
重置btn.setId(“亮橙色重置”);
resetBtn.getStyleClass().add(“按下按钮”);
setBTN.setOnAction(新的EventHandler(){
@凌驾
公共无效句柄(ActionEvent事件){
//重置
nameTxtArea.setText(“”);
convertbn.setDisable(Boolean.FALSE);
//printbn.setDisable(Boolean.TRUE);
nameTxtArea.requestFocus();
}
});
HBox HBox=新的HBox(100);
hBox.设置校准(位置中心);
hBox.getChildren().addAll(convertBtn);//将printBtn添加到
convertBtn,
VBox VBox=新的VBox(10);
vBox.SETALIGNERATION(位置上止点);
vBox.getChildren().addAll(logoBox、nameTxtArea、dummy、hBox、resetBtn);
vBox.setStyle(“-fx背景色:红色;边距:20px;”);
vBox.setId(“顶部半径”);
编辑:我没有第75行。代码在第73行结束。我通过CSSlint运行了它,没有看到与此相关的错误。使用相同的代码可以正常工作,但现在不是了


编辑:我删除了部分CSS并运行了该程序。该程序运行时应用了CSS样式。我完成了删除所有CSS代码并发生了同样的事情。为什么这样做?没有CSS代码时CSS如何运行?我的JavaFX中没有任何CSS命令,

对不起,CSS文件中的
*。text
是哪一行?错误是第75行有一条规则不受
JavaFX CSS
的支持,因此它可能是@KenY-N提到的。顺便说一句,可能有。我复制并粘贴了CSS到一个文件中,加载它时没有发现任何解析错误;因此一些文件内容异常,例如结尾的伪字符,是最可能的解释。