當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。