slam4:javafx

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
slam4:javafx [2017/09/11 01:21] – [Association d'écouteurs] jcheronslam4:javafx [2019/08/31 14:21] (Version actuelle) – modification externe 127.0.0.1
Ligne 31: Ligne 31:
 </sxh> </sxh>
  
 +===== Séparation des couches =====
 +
 +Chargement d'une vue à partir d'un fichier fxml :
 +
 +<sxh java;highlight:[4]>
 + @Override
 + public void start(Stage primaryStage) {
 + try {
 + BorderPane root = (BorderPane)FXMLLoader.load(getClass().getResource("Sample.fxml"));
 + Scene scene = new Scene(root,400,400);
 + scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
 + primaryStage.setScene(scene);
 + primaryStage.show();
 + } catch(Exception e) {
 + e.printStackTrace();
 + }
 + }
 +</sxh>
 +
 +<sxh xml;title:Sample.fxml>
 +<?xml version="1.0" encoding="UTF-8"?>
 +
 +<?import javafx.scene.control.Button?>
 +<?import javafx.scene.control.MenuButton?>
 +<?import javafx.scene.control.MenuItem?>
 +<?import javafx.scene.layout.AnchorPane?>
 +<?import javafx.scene.layout.BorderPane?>
 +
 +
 +<BorderPane xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/9.0.1" fx:controller="application.SampleController">
 +   <top>
 +      <MenuButton mnemonicParsing="false" text="MenuButton" BorderPane.alignment="CENTER">
 +        <items>
 +          <MenuItem mnemonicParsing="false" text="Action 1" />
 +          <MenuItem mnemonicParsing="false" text="Action 2" />
 +        </items>
 +      </MenuButton>
 +   </top>
 +   <center>
 +      <AnchorPane prefHeight="200.0" prefWidth="468.0" BorderPane.alignment="CENTER">
 +         <children>
 +            <Button fx:id="btAdd" layoutX="14.0" layoutY="14.0" mnemonicParsing="false" onAction="#btAddClick" prefHeight="25.0" prefWidth="115.0" text="Button" />
 +         </children>
 +      </AnchorPane>
 +   </center>
 +</BorderPane>
 +</sxh>
 ===== Association d'écouteurs ===== ===== Association d'écouteurs =====
 Java 8 permet l'utilisation des Lambda expressions : Java 8 permet l'utilisation des Lambda expressions :
Ligne 66: Ligne 113:
 ===== Ressources ===== ===== Ressources =====
 |< 100% >| |< 100% >|
-  |+fontawesomefx [[http://bitbucket.org/Jerady/fontawesomefx]] |
 |jfxtras | [[http://jfxtras.org/]] | |jfxtras | [[http://jfxtras.org/]] |
-|::: | [[http://central.maven.org/maven2/org/jfxtras/jfxtras-labs/8.0-r4/|Download jar]] |+|::: | [[http://central.maven.org/maven2/org/jfxtras/jfxtras-labs/|Download jar]] | 
 + 
 + 
 +===== Articles ===== 
 + 
 +  * [[http://code.makery.ch/blog/javafx-8-event-handling-examples/|event handling]] 
 +  * [[http://code.makery.ch/blog/javafx-dialogs-official/|Dialogs]] 
 +  * [[https://zeroturnaround.com/rebellabs/best-javafx-libraries-for-beautiful-apps-and-clean-code/|Best JavaFx libraries]]
  
  • slam4/javafx.1505085670.txt.gz
  • Dernière modification : il y a 6 ans
  • (modification externe)