当前位置: 首页>>代码示例>>Java>>正文


Java FXML类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:Chrisp1tv,项目名称:ScrabbleGame,代码行数:36,代码来源:GameController.java

示例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();
}
 
开发者ID:maximstewart,项目名称:UDE,代码行数:24,代码来源:Controller.java

示例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());
    }
}
 
开发者ID:identiv,项目名称:ts-cards,代码行数:28,代码来源:TsCardExplorerController.java

示例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();
		}
	}
	
}
 
开发者ID:krHasan,项目名称:Money-Manager,代码行数:21,代码来源:MakeATransactionController.java

示例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);
}
 
开发者ID:maillouxc,项目名称:git-rekt,代码行数:18,代码来源:BrowseRoomsScreenController.java

示例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;
   }
  
      
 }
 
开发者ID:ksaluja24,项目名称:scratch-bench,代码行数:27,代码来源:KController.java

示例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);
		}
	}
}
 
开发者ID:Seil0,项目名称:cemu_UI,代码行数:18,代码来源:MainWindowController.java

示例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;
}
 
开发者ID:jescascela,项目名称:Calculadora-JavaFx,代码行数:24,代码来源:Controller.java

示例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);
    }
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:19,代码来源:MainGuiController.java

示例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();
}
 
开发者ID:pxndroid,项目名称:mountieLibrary,代码行数:20,代码来源:MainWindowController.java

示例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;
}
 
开发者ID:ITB15-S4-GroupD,项目名称:Planchester,代码行数:24,代码来源:EditNonMusicalEventController.java

示例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();
	}
}
 
开发者ID:dev-andremonteiro,项目名称:AlphaLab,代码行数:18,代码来源:FrmCliente.java

示例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);
    }
}
 
开发者ID:dev-andremonteiro,项目名称:AlphaLab,代码行数:9,代码来源:ManutencaoSoftware.java

示例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();
}
 
开发者ID:ProgrammingLife2017,项目名称:hygene,代码行数:21,代码来源:LoggingSettingsViewController.java

示例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);
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:13,代码来源:LocationController.java


注:本文中的javafx.fxml.FXML类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。