Java Reference
In-Depth Information
@FXML
private Label currentDateLabel;
@FXML
private URL location;
@FXML
private ResourceBundle resources;
@FXML
public void initialize() {
locationLabel.setText(location.toString());
resourcesLabel.setText(resources.getBaseBundleName() +
" (" + resources.getLocale().getCountry() +
", " + resources.getLocale().getLanguage() + ")");
}
}
Listing 3-16. ResolutionAndBindingExample.java
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import java.util.ResourceBundle;
public class ResolutionAndBindingExample extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(
ResolutionAndBindingExample.class.getResource(
"/ResolutionAndBindingExample.fxml"));
fxmlLoader.setResources(
ResourceBundle.getBundle(
"ResolutionAndBindingExample"));
VBox vBox = fxmlLoader.load();
Scene scene = new Scene(vBox);
primaryStage.setTitle("Resolution and Binding Example");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Search WWH ::




Custom Search