如何通過hashmap傳遞「toEncrypt」文本並將其顯示在「encrypted」標籤上?這一直困擾着我。我只能得到用戶想要加密的內容,而不需要加密。如何通過HashMap發送文本?
@FXML
Button encrypt;
@FXML
Label encrypted;
@FXML
TextField toEncrypt;
@FXML
private void encryptButton(ActionEvent event) {
encrypted.setText(toEncrypt.getText());
}
@FXML
private void secretMessage (ActionEvent event) {
HashMap<String,String> secret = new HashMap<String, String>();
//*****UPPER CASE LETTERS*****
secret.put("A","9");
secret.put("B","J");
secret.put("C","Q");
secret.put("D","1");
secret.put("E","T");
secret.put("F","B");
secret.put("G","Z");
secret.put("H","R");
secret.put("I","t");
secret.put("J","m");
secret.put("K","q");
secret.put("L","p");
secret.put("M","o");
secret.put("N","3");
secret.put("O","v");
secret.put("P","y");
secret.put("Q","X");
secret.put("R","z");
secret.put("S","l");
secret.put("T","S");
secret.put("U","5");
secret.put("V","w");
secret.put("W","C");
secret.put("X","K");
secret.put("Y","8");
secret.put("Z","n");
//**********************
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}
'通過HashMap發送文本'沒有意義,請澄清你的問題。 – EJP