Game Development Reference
In-Depth Information
gameButton.setOnAction((ActionEvent event) -> {
splashScreenBackplate.setVisible(false);
splashScreenTextArea.setVisible(false);
});
As you can see in Figure 9-6 , this lambda expression that NetBeans wrote for you
is not without warnings itself, as there is a “Parameter event is not used” warning, so
we will be removing the event next, to make the lambda expression even more com-
pact! At some point in time, Oracle will update this code that writes lambda expres-
sions so that it looks inside of your method code block, sees that there is no event ob-
ject referenced, and will remove this as well, and the warning will no longer be gener-
ated. Until that time comes, we'll need to edit NetBeans' code ourselves.
Figure 9-6 . The lambda expression that NetBeans writes for you has a warning message “Parameter event is not
used”
Since we are not using the event variable inside of the code body of this lambda ex-
pression, we can remove it, giving us this following final Java 8 lambda expression
code, which is quite a bit more simple than the original code:
gameButton.setOnAction(( ActionEvent ) -> {
splashScreenBackplate.setVisible(false);
 
 
Search WWH ::




Custom Search