第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

JavaFX登錄訪問被拒絕

JavaFX登錄訪問被拒絕

UYOU 2021-04-15 13:11:10
當(dāng)我嘗試使用redbull作為用戶名和pass123作為密碼登錄時(shí),它不顯示已授予訪問權(quán)限的消息,而是轉(zhuǎn)到else語句并顯示訪問被拒絕的消息    Label usernameLb = new Label("Username:");    GridPane.setConstraints(usernameLb, 0, 0);    TextField usernameTf = new TextField();    usernameTf.setPromptText("Username");    GridPane.setConstraints(usernameTf , 1, 0);    Label passLb = new Label("Password:");    GridPane.setConstraints(passLb, 0, 1);    TextField passTf = new TextField();    passTf.setPromptText("Password");    GridPane.setConstraints(passTf, 1, 1);    Button loginBtn = new Button("Login");    loginBtn.setOnAction(e -> {        String username = usernameTf.getText();        String password = passTf.getText();        if (username == "redbull" && password == "pass123"){            System.out.println(username + "\n" + password);            JOptionPane.showMessageDialog(null,                     "Access Granted", " ", JOptionPane.PLAIN_MESSAGE);        } else {            System.out.println(username + "\n" + password);            JOptionPane.showMessageDialog(null,                     "Access Denied", " ", JOptionPane.PLAIN_MESSAGE);        }    });    GridPane.setConstraints(loginBtn, 1, 2);    gridPane.getChildren().addAll(usernameLb,     usernameTf, passLb, passTf, loginBtn);    Scene scene1 = new Scene(gridPane, 300, 200);    window.setScene(scene1);    window.show();}
查看完整描述

1 回答

?
有只小跳蛙

TA貢獻(xiàn)1824條經(jīng)驗(yàn) 獲得超8個(gè)贊

.equals()比較兩個(gè)字符串的值時(shí)使用。

(username.equals("redbull") && password.equals("pass123"))


查看完整回答
反對(duì) 回復(fù) 2021-04-21
  • 1 回答
  • 0 關(guān)注
  • 258 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)