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

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

以下是我的LoginPanel按鈕代碼,關(guān)于用戶傳值的問題,請(qǐng)問該怎么辦?

以下是我的LoginPanel按鈕代碼,關(guān)于用戶傳值的問題,請(qǐng)問該怎么辦?

元芳怎么了 2022-05-26 11:07:59
//以下是我的LoginPanel按鈕代碼,我想把輸出的user.getCidId() 傳到第二個(gè)Swing (MainPanel)的JLabelprivate void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {// TODO add your handling code here:String at = log_a.getText();// int i = Integer.parseInt(at);String bt = new String(log_b.getPassword());boolean b = true;if (at.equals("")) {log_check_a.setText("卡號(hào)不能為空");b = false;}if (bt.equals("")) {log_check_b.setText("密碼不能為空");b = false;}Users user = new Users();user.setCidId(at);user.setPassWord(bt);UsersService usersService = new UsersService();Users u = usersService.loging(user);if (at.equals(user.getCidId())) {System.out.println("卡號(hào):" + user.getCidId() + "\n" + "已登錄銀行系統(tǒng)!");MainPanel.main(null);dispose();} else {System.out.println("登錄失敗");JOptionPane.showConfirmDialog(null, "卡號(hào)或密碼不正確,如需幫助請(qǐng)撥打熱線");}}private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {// TODO add your handling code here: 卡戶跳轉(zhuǎn)RegPanel.main(null);dispose();}/*** @param args the command line arguments*/public static void main(String args[]) {java.awt.EventQueue.invokeLater(new Runnable() {public void run() {new LoginPanel().setVisible(true);}});}
查看完整描述

1 回答

?
翻過高山走不出你

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

MainPanel改造下:


public class MainPanel{    // 構(gòu)造函數(shù)     public MainPanel(){}     // 初始化后MainPanel     public void initMainPanel(){            // 構(gòu)建界面,初始化變量等      }    public void setValues(String cidId){        // 根據(jù)cidId進(jìn)行一些設(shè)置        .......其他一些自己的方法和變量......      }

LoginPanel的下面一段改造下:


if (at.equals(user.getCidId())) {    System.out.println("卡號(hào):" + user.getCidId() + "\n" "已登錄銀行系統(tǒng)!");    MainPanel mainPanel=new MainPanel(); // 創(chuàng)建界面實(shí)例    mainPanel.initMainPanel();           // 初始化界面    mainPanel.setValues(user.getCidId());// 給界面設(shè)置值     dispose();    }


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

添加回答

舉報(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)