本文整理汇总了Java中javafx.fxml.FXML类的典型用法代码示例。如果您正苦于以下问题:Java FXML类的具体用法?Java FXML怎么用?Java FXML使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FXML类属于javafx.fxml包,在下文中一共展示了FXML类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleSaveGame
import javafx.fxml.FXML; //导入依赖的package包/类
/**
* Opens a dialog to save the game
*/
@FXML
protected void handleSaveGame() {
try {
// Load game saving view
FXMLLoader loader = new FXMLLoader();
loader.setResources(this.scrabble.getI18nMessages());
loader.setLocation(Scrabble.class.getResource("view/SaveGame.fxml"));
VBox page = loader.load();
// Create the dialog stage
Stage dialogStage = new Stage();
dialogStage.setMinWidth(SaveGameController.STAGE_WIDTH);
dialogStage.setMaxWidth(SaveGameController.STAGE_WIDTH);
dialogStage.setMinHeight(SaveGameController.STAGE_HEIGHT);
dialogStage.setMaxHeight(SaveGameController.STAGE_HEIGHT);
dialogStage.setTitle(this.scrabble.getI18nMessages().getString("save"));
dialogStage.initModality(Modality.WINDOW_MODAL);
dialogStage.initOwner(this.scrabble.getPrimaryStage());
Scene scene = new Scene(page);
dialogStage.setScene(scene);
SaveGameController controller = loader.getController();
controller.setDialogStage(dialogStage);
controller.setScrabble(this.scrabble);
dialogStage.showAndWait();
} catch (IOException e) {
this.scrabble.showGeneralApplicationError(e);
}
}
示例2: handleMouseClicked
import javafx.fxml.FXML; //导入依赖的package包/类
@FXML
private void handleMouseClicked(MouseEvent mouseEvent) {
if(mouseEvent.getClickCount() == 1){
try{
TreeItem<String> item = treeview.getSelectionModel().getSelectedItem();
Fx1.CurrDirName = item.getValue();
System.out.println("Selected Text : " + item.getValue());
Fx1.CurrDirFile = new File(Fx1.FindAbsolutePath(item,item.getValue()));
Fx1.CurrDirStr = Fx1.CurrDirFile.getAbsolutePath();
label.setText(Fx1.CurrDirStr);
Fx2.tableview.getItems().clear();
Fx2.CreateTableView();
Fx3.CreateTiles();
/**tableview.getItems().clear();
CreateTableView();
/**call some other function to activate createtableview() in corres controller */
}catch(Exception x){
System.out.println(x.getMessage());
}
}
//Fx2.tableview.getItems().clear();
//Fx2.CreateTableView();
}
示例3: onBtnChangePiccKeyClicked
import javafx.fxml.FXML; //导入依赖的package包/类
@FXML
private void onBtnChangePiccKeyClicked(ActionEvent event) {
try {
SmartcardIoTransmitter transmitter = SmartcardIoTransmitter.create();
ApduSession session = new ApduSession();
session.nextCommands(new GetVersion());
session.transmit(transmitter);
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("fxml/ChangePiccKey.fxml"));
Parent root = (Parent)fxmlLoader.load();
ChangePiccKeyController controller = fxmlLoader.<ChangePiccKeyController>getController();
String curr_key = checkUseKeyDiv()
? edDiversificationKey.getText()
: (edNoDivKey.isDisable()?"":edNoDivKey.getText());
controller.setSession(session, historyData, checkUseKeyDiv(), curr_key,
cbTypes.getValue().equals("AES"));
Stage stage = new Stage();
stage.setTitle("Change PICC Key");
stage.setScene(new Scene(root, 450, 300));
stage.showAndWait();
} catch (Exception e) {
lbResultTabApp.setText(e.getMessage());
}
}
示例4: gmAmountValidation
import javafx.fxml.FXML; //导入依赖的package包/类
@FXML
private void gmAmountValidation() {
if (!validAmount(gmtxtAmount.getText())) {
if (!gmtxtAmount.getText().isEmpty()) {
gmlblWarningMsg.setText(InvalidInput);
gmtxtAmount.clear();
}
} else {
gmlblWarningMsg.setText(" ");
try {
gmUpdateBalanceShow();
} catch (Exception e) {
e.printStackTrace();
}
}
}
示例5: onNextButtonClicked
import javafx.fxml.FXML; //导入依赖的package包/类
@FXML
private void onNextButtonClicked() {
// Prevent proceeding when no rooms are selected
if(selectedRooms.size() <= 0) {
return;
}
Object temp = ScreenManager.getInstance().switchToScreen("/fxml/PlaceBookingScreen.fxml");
PlaceBookingScreenController controller = (PlaceBookingScreenController) temp;
Map<RoomCategory, Integer> roomsData = new HashMap<>();
LocalDate checkInDate = checkInDatePicker.getValue();
LocalDate checkOutDate = checkOutDatePicker.getValue();
selectedRooms.forEach((r) -> {
roomsData.merge(r.getRoomCategory(), 1, Integer::sum);
});
controller.initializeData(roomsData, this.packageQtys, checkInDate, checkOutDate);
}
示例6: emailcheck
import javafx.fxml.FXML; //导入依赖的package包/类
@FXML
private void emailcheck(KeyEvent k)
{
String c=k.getCharacter();
if(c.equals(" "))
{
k.consume();
}
String EMAIL_REGEX = "^[\\w-_\\.+]*[\\w-_\\.]\\@([\\w]+\\.)+[\\w]+[\\w]$";
if(userNameTF.getText().matches(EMAIL_REGEX))
{
validateFalseLabel.setVisible(false);
validateTrueLabel.setVisible(true);
validateTrueLabel.setText("Kindly click on Login");
b=true;
}
else
{
validateTrueLabel.setVisible(false);
validateFalseLabel.setVisible(true);
validateFalseLabel.setText("Invalid E-Mail Format");
b=false;
}
}
示例7: romTFBtnAction
import javafx.fxml.FXML; //导入依赖的package包/类
@FXML
void romTFBtnAction(ActionEvent event) {
File romDirectory = directoryChooser.showDialog(main.getPrimaryStage());
if (romDirectory == null) {
LOGGER.info("No Directory selected");
} else {
setRomPath(romDirectory.getAbsolutePath());
saveSettings();
cemuTextField.setText(getCemuPath());
try {
Runtime.getRuntime().exec("java -jar cemu_UI.jar"); // start again
System.exit(0); // finishes itself
} catch (IOException e) {
LOGGER.error("an error occurred", e);
}
}
}
示例8: processDot
import javafx.fxml.FXML; //导入依赖的package包/类
@FXML
private void processDot(ActionEvent event) {
//Impede que pontos (vírgula) sejam concatenados como resultado de uma operação
if (start) {
output.setText("");
start = false;
}
//Impede que o ponto (vírgula) seja clicada mais de uma vez
if (dot) {
return;
}
//Impede que inicie um número clicando no ponto (vírgula)
if (!number1Value) {
return;
}
String value = ((Button) event.getSource()).getText();
output.setText(output.getText() + value);
dot = true;
}
示例9: handleButtonBrowseGoogleFit
import javafx.fxml.FXML; //导入依赖的package包/类
@FXML
private void handleButtonBrowseGoogleFit(ActionEvent event) {
Stage stage = (Stage) ap.getScene().getWindow();
File lastPath = new File(prefs.get(Constants.IMPORTER_GOOGLE_FIT_IMPORT_PATH_KEY + 0, ""));
FileChooser fileChooser = new FileChooser();
configureFileChooser(fileChooser, lastPath, Constants.CSV_EXTENSION_FILTER);
List<File> files = fileChooser.showOpenMultipleDialog(stage);
if (files != null && !files.isEmpty()) {
StringBuilder sb = new StringBuilder();
files.forEach((item) -> {
sb.append(item.getAbsolutePath()).append(Constants.MULTI_FILE_PATH_DELIMITER);
});
googleFitTextField.setText(sb.toString().substring(0, sb.length() - 1));
googleFitCheckBox.setSelected(true);
}
}
示例10: logoutUser
import javafx.fxml.FXML; //导入依赖的package包/类
/**
* Handles logout request, and return the user to the login screen.
* @param event The event that trigger this function.
* @throws IOException If the fxml was not found.
*/
@FXML public void logoutUser(ActionEvent event) throws IOException
{
//Close current window, and go back to login screen
Stage stage = (Stage) menuBar.getScene().getWindow();
stage.close();
Stage stage2 = new Stage();
Parent root2 = FXMLLoader.load(getClass().getResource("/dataBaseLogin/MountieLib.fxml"));
Scene scene2 = new Scene(root2);
stage2.setScene(scene2);
stage2.getIcons().add(new Image("images/titleIcon.png"));
stage2.initModality(Modality.NONE);
stage2.show();
}
示例11: cancel
import javafx.fxml.FXML; //导入依赖的package包/类
@FXML
@Override
protected boolean cancel() {
String pointRef = (initEventDutyDTO.getPoints() != null)? String.valueOf(initEventDutyDTO.getPoints()) : "0.0";
if(!name.getText().equals(initEventDutyDTO.getName())
|| !description.getText().equals(initEventDutyDTO.getDescription())
|| !date.getValue().equals(initEventDutyDTO.getEndTime().toLocalDateTime().toLocalDate())
|| !startTime.getValue().equals(initEventDutyDTO.getStartTime().toLocalDateTime().toLocalTime())
|| !endTime.getValue().equals(initEventDutyDTO.getEndTime().toLocalDateTime().toLocalTime())
|| !eventLocation.getText().equals(initEventDutyDTO.getLocation())
|| !points.getText().equals(pointRef)) {
Alert confirmationAlertMessage = new Alert(Alert.AlertType.CONFIRMATION, PlanchesterMessages.DISCARD_CHANGES, ButtonType.YES, ButtonType.NO);
confirmationAlertMessage.showAndWait();
if (confirmationAlertMessage.getResult() == ButtonType.NO) {
return false;
}
}
// remove content of sidebar
EventScheduleController.resetSideContent();
EventScheduleController.removeSelection(initAppointment);
return true;
}
示例12: btnExcluir_onAction
import javafx.fxml.FXML; //导入依赖的package包/类
@FXML
void btnExcluir_onAction(ActionEvent event) {
if (tblClientes.getSelectionModel().getSelectedIndex() >= 0) {
dlgConfirmacao.setTitle("CONFIRMAÇÃO");
dlgConfirmacao.setContentText("Tem certeza que deseja excluir?\nEsta operação não poderá ser desfeita.");
Optional<ButtonType> result = dlgConfirmacao.showAndWait();
if (result.isPresent() && result.get() == bttSim) {
cliente.delete(tblClientes.getSelectionModel().getSelectedItem());
btnProcurar.fire();
lblStatus.setText("Cliente excluído com sucesso.");
}
} else {
dlgMensagem.setTitle("ERRO DE SELEÇÃO");
dlgMensagem.setContentText("É preciso selecionar um cliente da tabela para poder realizar a exclusão.");
dlgMensagem.showAndWait();
}
}
示例13: btnEditarOnAction
import javafx.fxml.FXML; //导入依赖的package包/类
@FXML
public void btnEditarOnAction(ActionEvent evt) {
SoftwareEntity tmpSoftware = getSoftwareSelected();
if (tmpSoftware != null) {
setSoftware(tmpSoftware);
tbpGerenciaSoftware.getSelectionModel().select(tabSoftware);
}
}
示例14: onLogLevelChanged
import javafx.fxml.FXML; //导入依赖的package包/类
/**
* When the user changes the log level and new {@link Runnable} command is added to {@link Settings}.
* <p>
* Command run when the user applies the change in setting.
*
* @param event action event
*/
@FXML
public void onLogLevelChanged(final ActionEvent event) {
settings.addRunnable(() -> {
final String logLevel = choiceBox.getSelectionModel().getSelectedItem();
final Logger logger = LogManager.getRootLogger();
Configurator.setLevel(logger.getName(), Level.toLevel(logLevel));
LOGGER.info("Log level was set to: " + Level.toLevel(logLevel));
});
event.consume();
}
示例15: mouseExited
import javafx.fxml.FXML; //导入依赖的package包/类
@FXML
private void mouseExited() {
final LocationPresentation locationPresentation = (LocationPresentation) this.root;
if(!locationPresentation.isInteractable()) return;
circle.setCursor(Cursor.DEFAULT);
locationPresentation.animateHoverExited();
KeyboardTracker.unregisterKeybind(KeyboardTracker.MAKE_LOCATION_URGENT);
KeyboardTracker.unregisterKeybind(KeyboardTracker.MAKE_LOCATION_COMMITTED);
}