< prev index next >

modules/javafx.fxml/src/main/docs/javafx/fxml/doc-files/introduction_to_fxml.html

Print this page
rev 10444 : imported patch doc-8177566-trampoline
rev 10445 : [mq]: doc-v1-8177566-trampoline

*** 13,23 **** <div class="fx-code-header"> <div class="version"><br/>Release: JavaFX 9</div> </div> <h1>Introduction to FXML</h1> ! <p class="subtitle">Last updated: 3/3/2017</p> <h2>Contents</h2> <ul class="contents"> <li><a href="#overview">Overview</a></li> <li> --- 13,23 ---- <div class="fx-code-header"> <div class="version"><br/>Release: JavaFX 9</div> </div> <h1>Introduction to FXML</h1> ! <p class="subtitle">Last updated: 01 May 2017</p> <h2>Contents</h2> <ul class="contents"> <li><a href="#overview">Overview</a></li> <li>
*** 87,96 **** --- 87,97 ---- <a href="#fxmlloader">FXMLLoader</a> <ul> <li><a href="#custom_components">Custom Components</a></li> </ul> </li> + <li><a href="#deploy_as_module">Deploying an Application as a Module</a></li> </ul> <h2><a name="overview">Overview</a></h2> <p>FXML is a scriptable, XML-based markup language for constructing Java object graphs. It provides a convenient alternative to constructing such graphs in procedural code, and is ideally suited to defining the user interface of a JavaFX application, since the hierarchical structure of an XML document closely parallels the structure of the JavaFX scene graph.</p>
*** 884,896 **** group="controllers">However, for developers who prefer more restricted visibility for controller fields or handler methods, the <span class="code">javafx.fxml.FXML</span> annotation can be used. This annotation marks a protected or private class member as accessible to FXML. ! If the class being annotated is part of a named module, the module containing that class must <span class="code">open</span> ! the containing package to the <span class="code">javafx.fxml</span> module.</assert></span> <p>For example, the controllers from the previous examples could be rewritten as follows:</p> <pre class="code"> --- 885,897 ---- group="controllers">However, for developers who prefer more restricted visibility for controller fields or handler methods, the <span class="code">javafx.fxml.FXML</span> annotation can be used. This annotation marks a protected or private class member as accessible to FXML. ! If the class being annotated is in a named module, the module containing that class must <span class="code">open</span> ! the containing package to at least the <span class="code">javafx.fxml</span> module.</assert></span> <p>For example, the controllers from the previous examples could be rewritten as follows:</p> <pre class="code">
*** 1043,1052 **** --- 1044,1074 ---- &lt;HBox&gt; &lt;CustomControl text="Hello World!"/&gt; &lt;/HBox&gt; </pre> + <h2><a name="deploy_as_module">Deploying an Application as a Module</a></h2> + <p>If <span class="code">FXMLLoader</span> is used to load types in a named + module, the application must ensure that all types that are referenced in the + FXML files, including the controller class and any custom <span class="code">Node</span> + classes, are reflectively accessible to the <span class="code">javafx.fxml</span> + module. A type is reflectively accessible if the module + <span class="code">opens</span> the containing package to at least the + <span class="code">javafx.fxml</span> module. + </p> + + <p>For example, if <span class="code">com.foo.MyController</span> is in the + <span class="code">foo.app</span> module, the + <span class="code">module-info.java</span> might look like this: + </p> + <pre><span class="code">module foo.app { + opens com.foo to javafx.fxml; + }</span></pre> + + <p>Alternatively, a type is reflectively accessible if the module + <span class="code">exports</span> the containing package unconditionally. + </p> <hr> <p> <font size="-1"><a href="http://bugreport.java.com/bugreport/" target="_blank">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://download.java.net/java/jdk9/docs/index.html" target="_blank">Java SE Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.<br> <a href="http://download.java.net/java/jdk9/docs/legal/cpyr.html" target="_blank">Copyright</a> &copy; 2008, 2017, Oracle and/or its affiliates. All rights reserved.<br><b>DRAFT 9-ea</b></font> </p> </body>
< prev index next >