Java Reference
In-Depth Information
<Label fx:id="locationLabel" text="[location]"/>
<Label text="Resources:">
<font>
<Font name="System Bold" size="14.0"/>
</font>
</Label>
<Label fx:id="resourcesLabel" text="[resources]"/>
</children>
<opaqueInsets>
<Insets/>
</opaqueInsets>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
</padding>
</VBox>
Listing 3-8. FXMLInjectionExampleController.java
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import java.net.URL;
import java.util.ResourceBundle;
public class FXMLInjectionExampleController {
@FXML
private Label resourcesLabel;
@FXML
private Label locationLabel;
@FXML
private URL location;
@FXML
private ResourceBundle resources;
@FXML
public void initialize() {
locationLabel.setText(location.toString());
resourcesLabel.setText(resources.getBaseBundleName());
}
}
Listing 3-9. FXMLInjectionExampleMain.java
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
Search WWH ::




Custom Search