toggleButtonGroup类不存在javafx

时间:2017-04-08 00:01:27

标签: javafx javafx-2 javafx-8 fxml

我从未得到像这样的错误toggleButtonGroup类不存在javafx 我搜索但没有找到像这样的错误 所以这不是重复的问题 感谢

这里是我的fxml代码

<?xml version="1.0" encoding="UTF-8"?>

<?import com.gluonhq.charm.glisten.control.ToggleButtonGroup?>
<?import com.jfoenix.controls.JFXButton?>
<?import com.jfoenix.controls.JFXTextArea?>
<?import com.jfoenix.controls.JFXTextField?>
<?import com.jfoenix.controls.JFXToggleButton?>
<?import java.net.URL?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.RadioButton?>
<?import javafx.scene.control.Separator?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?>

<AnchorPane id="AnchorPane" maxHeight="568.0" maxWidth="699.0" prefHeight="589.0" prefWidth="699.0" styleClass="mainFxmlClass" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="Controller.AjouterEmployerController">
    <stylesheets>
        <URL value="@/css/ajouteremployer.css" />
    </stylesheets>
   <children>
      <Pane layoutX="330.0" prefHeight="568.0" prefWidth="15.0" style="-fx-background-color: black;" />
      <Separator layoutX="324.0" orientation="VERTICAL" prefHeight="568.0" prefWidth="9.0" />
      <Separator layoutX="346.0" orientation="VERTICAL" prefHeight="568.0" prefWidth="1.0" />
      <Pane layoutX="-1.0" layoutY="-2.0" prefHeight="568.0" prefWidth="328.0">
         <children>
            <Separator layoutX="14.0" orientation="VERTICAL" prefHeight="568.0" prefWidth="6.0" />
            <Separator layoutX="128.0" orientation="VERTICAL" prefHeight="435.0" prefWidth="6.0" />
            <Separator layoutX="285.0" orientation="VERTICAL" prefHeight="568.0" prefWidth="6.0" />
            <Label layoutX="30.0" layoutY="15.0" prefHeight="17.0" prefWidth="94.0" text="CNE      :" />
            <Label layoutX="30.0" layoutY="54.0" prefHeight="17.0" prefWidth="94.0" text="first name" />
            <Label layoutX="30.0" layoutY="94.0" prefHeight="17.0" prefWidth="94.0" text="lastname" />
            <Label layoutX="30.0" layoutY="168.0" prefHeight="17.0" prefWidth="76.0" text="phone" />
            <Label layoutX="30.0" layoutY="209.0" prefHeight="17.0" prefWidth="66.0" text="section" />
            <Label layoutX="30.0" layoutY="255.0" text="transporte" />
            <Label layoutX="30.0" layoutY="291.0" text="note" />
            <JFXTextField fx:id="AddCNE" layoutX="131.0" layoutY="11.0" prefHeight="25.0" prefWidth="152.0" />
            <JFXTextField fx:id="AddFirstName" layoutX="131.0" layoutY="50.0" prefHeight="25.0" prefWidth="152.0" />
            <JFXTextField fx:id="AddLastName" layoutX="131.0" layoutY="90.0" prefHeight="25.0" prefWidth="152.0" />
            <JFXTextField fx:id="AddAge" layoutX="131.0" layoutY="128.0" prefHeight="25.0" prefWidth="152.0" />
            <JFXTextField fx:id="AddPhone" layoutX="131.0" layoutY="164.0" prefHeight="25.0" prefWidth="152.0" />
            <JFXToggleButton fx:id="AddTransport" layoutX="155.0" layoutY="235.0" prefHeight="56.0" prefWidth="105.0" text="YES" />
            <Label layoutX="152.0" layoutY="255.0" prefHeight="17.0" prefWidth="24.0" text="NO" />
            <JFXTextArea fx:id="AddNote" layoutX="131.0" layoutY="286.0" prefHeight="131.0" prefWidth="152.0" />
            <JFXButton fx:id="AddEmployer" buttonType="RAISED" layoutX="207.0" layoutY="442.0" onAction="#AddEmployerAndSelectEmpolyer" prefHeight="36.0" prefWidth="76.0" ripplerFill="#7ffc7a" style="-fx-background-color: #188616;" text="ADD" textFill="#e5e8eb" />
            <Separator layoutX="14.0" layoutY="434.0" prefHeight="3.0" prefWidth="271.0" />
            <JFXButton fx:id="resetAll" layoutX="20.0" layoutY="442.0" onAction="#reset" prefHeight="36.0" prefWidth="66.0" ripplerFill="#7ef878" style="-fx-background-color: #188616;" text="reset" textFill="#f0f1f2" />
            <Label fx:id="messageAdd" layoutX="25.0" layoutY="497.0" prefHeight="56.0" prefWidth="254.0" textFill="#eb0909e9" wrapText="true" />
            <Label layoutX="30.0" layoutY="132.0" prefHeight="17.0" prefWidth="48.0" text="age" />
            <ToggleButtonGroup fx:id="SectionValue" layoutX="150.0" layoutY="205.0" selectionType="SINGLE">
               <toggles>
                  <RadioButton fx:id="SectionA" mnemonicParsing="false" prefHeight="17.0" prefWidth="41.0" text="A" />
                  <RadioButton fx:id="SectionB" layoutX="10.0" layoutY="10.0" mnemonicParsing="false" prefHeight="17.0" prefWidth="45.0" text="B" />
                  <RadioButton fx:id="sectionC" layoutX="97.0" layoutY="10.0" mnemonicParsing="false" prefHeight="17.0" prefWidth="44.0" text="C" />
               </toggles>
            </ToggleButtonGroup>

         </children>
      </Pane>
      <VBox layoutX="384.0" layoutY="33.0" prefHeight="459.0" prefWidth="295.0">
         <children>
            <HBox>
               <children>
                  <Label fx:id="cneEmployer" prefHeight="17.0" prefWidth="88.0">
                     <padding>
                        <Insets bottom="10.0" top="10.0" />
                     </padding>
                  </Label>
                  <Label fx:id="cneEmployerValue" prefHeight="17.0" prefWidth="172.0">
                     <padding>
                        <Insets bottom="10.0" top="10.0" />
                     </padding>
                  </Label>
               </children>
            </HBox>
            <HBox>
               <children>
                  <Label fx:id="firstName" prefHeight="17.0" prefWidth="92.0">
                     <padding>
                        <Insets bottom="10.0" top="10.0" />
                     </padding>
                     <HBox.margin>
                        <Insets />
                     </HBox.margin>
                  </Label>
                  <Label fx:id="firstNameValue" prefHeight="17.0" prefWidth="208.0">
                     <padding>
                        <Insets bottom="10.0" top="10.0" />
                     </padding>
                  </Label>
               </children>
               <padding>
                  <Insets bottom="10.0" top="10.0" />
               </padding>
            </HBox>
            <HBox>
               <children>
                  <Label fx:id="latName" prefHeight="17.0" prefWidth="90.0">
                     <padding>
                        <Insets bottom="10.0" top="10.0" />
                     </padding>
                  </Label>
                  <Label fx:id="LastNameValue" prefHeight="17.0" prefWidth="196.0">
                     <padding>
                        <Insets bottom="10.0" top="10.0" />
                     </padding>
                  </Label>
               </children>
            </HBox>
            <HBox>
               <children>
                  <Label fx:id="LabelAge" prefHeight="17.0" prefWidth="135.0">
                     <padding>
                        <Insets bottom="10.0" top="10.0" />
                     </padding>
                  </Label>
                  <Label fx:id="LabelAgeValue" prefHeight="17.0" prefWidth="249.0">
                     <padding>
                        <Insets bottom="10.0" top="10.0" />
                     </padding>
                  </Label>
               </children>
            </HBox>
            <HBox>
               <children>
                  <Label fx:id="num" prefHeight="17.0" prefWidth="110.0">
                     <padding>
                        <Insets bottom="10.0" top="10.0" />
                     </padding>
                  </Label>
                  <Label fx:id="phoneValue" prefHeight="17.0" prefWidth="223.0">
                     <padding>
                        <Insets bottom="10.0" top="10.0" />
                     </padding>
                  </Label>
               </children>
            </HBox>
            <HBox>
               <children>
                  <Label fx:id="sectionn" prefHeight="17.0" prefWidth="113.0">
                     <padding>
                        <Insets bottom="10.0" top="10.0" />
                     </padding>
                  </Label>
                  <Label fx:id="Sectionvalue" prefHeight="17.0" prefWidth="221.0">
                     <padding>
                        <Insets bottom="10.0" top="10.0" />
                     </padding>
                  </Label>
               </children>
            </HBox>
            <HBox>
               <children>
                  <Label fx:id="transportt" prefHeight="17.0" prefWidth="122.0">
                     <padding>
                        <Insets bottom="10.0" top="10.0" />
                     </padding>
                  </Label>
                  <Label fx:id="tranportValue" prefHeight="17.0" prefWidth="231.0">
                     <padding>
                        <Insets bottom="10.0" top="10.0" />
                     </padding>
                  </Label>
               </children>
            </HBox>
            <HBox prefHeight="148.0" prefWidth="254.0">
               <children>
                  <Label fx:id="note" prefHeight="148.0" prefWidth="137.0" />
                  <Label fx:id="noteValue" prefHeight="147.0" prefWidth="256.0" wrapText="true" />
               </children>
            </HBox>
         </children>
      </VBox>
   </children>
</AnchorPane>

this is the errure

this the second erreur

1 个答案:

答案 0 :(得分:0)

尝试添加像这样的ToggleGroups

<VBox>
    <RadioButton text="A" fx:id="radioButton1">
        <toggleGroup>
            <ToggleGroup fx:id="toggleGroup1"/>
        </toggleGroup>
    </RadioButton>
    <RadioButton text="B" toggleGroup="$toggleGroup1" fx:id="radioButton2"/>
</VBox>