问题是IntelliJ的想法不允许我使用getTarget()
方法。基本想法是在您点击AnchorPane
时显示jfxbutton
。怎么做?我有一种感觉,我需要连接一个库,但是哪一个。
控制器
package sample;
import com.jfoenix.controls.JFXButton;
import javafx.fxml.FXML;
import javafx.scene.layout.AnchorPane;
import java.awt.event.MouseEvent;
import javafx.event.EventTarget;
import javafx.event.ActionEvent;
import javafx.animation.*;
public class Controller {
@FXML
private AnchorPane area;
@FXML
private AnchorPane per;
@FXML
private JFXButton btn_per;
@FXML
private JFXButton btn_area;
int i = 1;
@FXML
private void handleButtonAction (MouseEvent event) {
if (event.getTarget() == btn_per) { //This
per.setVisible(true);
}
}
public void initialize() {
btn_per.setOnAction(event -> {
per.setVisible(true);
area.setVisible(false);
});
btn_area.setOnAction(event -> {
per.setVisible(false);
area.setVisible(true);
});
}
}