Servis-Rhino 4211B Guia do Utilizador Página 285

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 298
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 284
Scenic View
This is a JavaFX application that interrogates the data of a running Java Application.
See also:
Scenic View
Skeleton JavaFX Files
Sample application
This is the core of a JavaFX application. It assumes that an FXML file describes the content and
that the FXML controller is also this class. In order to use it we should:
Change the class name
Create an FXML file that names this class as its controller
Change the FXMLLoader.load() call to point to the newly created FXML file
Implement any logic in the initialize() function that is called when the controller is
started
Ensure that any Java project that contains JavaFX also has the jfxrt.jar on the project's
build path
package com.kolban;
import javafx.application.Application;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
/**
* @author Neil Kolban ([email protected])
* @version 2014-05-05
*/
// Change class name
public class SampleApp extends Application{
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) throws Exception {
// Change FXML file name and location
Parent root = FXMLLoader.load(getClass().getResource("fxml/Sample.fxml"));
Scene scene = new Scene(root, 600, 400);
stage.setScene(scene);
stage.show();
}
@FXML
private void initialize() {
} // End of initialized
} // End of class
// End of file
Sample Component
A component is a building block in the JavaFX architecture. It is common for us to want to create
Page 285
Vista de página 284
1 2 ... 280 281 282 283 284 285 286 287 288 289 290 ... 297 298

Comentários a estes Manuais

Sem comentários