FXML full reference?

后端 未结 3 484
遇见更好的自我
遇见更好的自我 2020-12-28 13:02

I\'m trying to learn JavaFX 2.0 + FXML, and i found it kind of uncomfortable to make fxml file, without knowing what i can put in it and what i can\'t. I mean which tags are

相关标签:
3条回答
  • 2020-12-28 13:39

    FXML Reference

    Introduction to FXML describes the syntax and usage patterns of the markup and is important to study when learning FXML. It does not define all elements usable in FXML.

    There will never be a full reference (nor xml schema) for FXML as it works by reflecting on Java classes in the classpath and defining elements and attributes based on the properties of the classes.

    FXML's creator (Greg Brown) suggests:

    So currently Javadoc is the best reference.

    For future Javadoc revisions of JavaFX, the JavaFX team is considering including FXML examples in the Javadoc.

    This forum thread and this forum thread contains discussions about and links to fxml documentation.

    FXML code completion in IDEs

    • NetBeans 7.3 provides FXML code completion.
    • The defacto JavaFX eclipse plugin e(fx)clipse provides FXML code completion.
    • Intellij Idea 12.1 provides FXML code completion.

    These IDE inference engines work by reflecting on Java classes the same way the FXML implementation does.

    When you use a library like ControlsFX, or develop your own JavaFX components, the IDE code completion is able to make use of the new classes and attributes you have created or linked.

    0 讨论(0)
  • 2020-12-28 13:43

    To keep the answer updated here is the Javadoc for Javafx 8.

    0 讨论(0)
  • 2020-12-28 13:54
    <?xml version="1.0" encoding="UTF-8"?>
    
    <?import javafx.scene.text.*?>
    <?import java.lang.*?>
    <?import java.util.*?>
    <?import javafx.scene.*?>
    <?import javafx.scene.control.*?>
    <?import javafx.scene.layout.*?>
    
    <AnchorPane id="AnchorPane" prefHeight="507.0" prefWidth="485.0" 
     stylesheets="@style.css" xmlns="http://javafx.com/javafx/8" 
     xmlns:fx="http://javafx.com/fxml/1" 
     fx:controller="javafxapplication11.FXMLDocumentController">
     <children>
      <MenuBar layoutY="2.0">
        <menus>
          <Menu mnemonicParsing="false" text="File">
            <items>
              <MenuItem mnemonicParsing="false" text="Close" />
            </items>
          </Menu>
          <Menu mnemonicParsing="false" text="Edit">
            <items>
              <MenuItem mnemonicParsing="false" text="Delete" />
            </items>
          </Menu>
          <Menu mnemonicParsing="false" text="Help">
            <items>
              <MenuItem mnemonicParsing="false" text="About" />
            </items>
          </Menu>
        </menus>
      </MenuBar>
      <Label layoutX="54.0" layoutY="60.0" prefHeight="27.0" prefWidth="377.0" text="Choose Any One Of The Options" textFill="#2614e8">
         <font>
            <Font name="Arial Bold" size="24.0" />
         </font>
      </Label>
      <CheckBox fx:id="c1" layoutX="54.0" layoutY="116.0" mnemonicParsing="false" onAction="#clicked1" text="Add DCU" />
      <CheckBox fx:id="c2" layoutX="54.0" layoutY="169.0" mnemonicParsing="false" onAction="#clicked2" text="Add Meter" />
      <CheckBox fx:id="c3" layoutX="54.0" layoutY="224.0" mnemonicParsing="false" onAction="#clicked3" text="Add Iologic" />
      <CheckBox fx:id="c4" layoutX="56.0" layoutY="273.0" mnemonicParsing="false" onAction="#clicked4" text="View DCU" />
      <CheckBox fx:id="c5" layoutX="54.0" layoutY="324.0" mnemonicParsing="false" onAction="#clicked5" text="View Meter" />
      <CheckBox fx:id="c6" layoutX="51.0" layoutY="372.0" mnemonicParsing="false" onAction="#clicked6" text="View  Iologic" />
      <CheckBox fx:id="c7" layoutX="54.0" layoutY="417.0" mnemonicParsing="false" onAction="#clicked7" text="Test DCU" />
      <CheckBox fx:id="c8" layoutX="54.0" layoutY="461.0" mnemonicParsing="false" onAction="#clicked8" text="Diagnostics" />
        </children>
       </AnchorPane>
    
    0 讨论(0)
提交回复
热议问题