用netbeans编写的以下代码假设将属于组合框的每个用户记录到系统中。用户名、密码和As是匹配的,但是在将组合框中的值分配为登录标准时遇到问题
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
String inputusername = jTextField1.getText();
String inputpassword = jPasswordField1.getText();
String inputAs = jComboBox2.getText();
if(inputusername.trim().length() == 0 ||
(inputpassword.trim().length() == 0) ||
(inputAs.trim().length() == 0)) {
JOptionPane.showMessageDialog(this,"Error.", "Incomplete Fields",
JOptionPane.WARNING_MESSAGE);
}else{
Login l = new Login(inputusername,inputpassword,inputAs);
jTextField3.setText(l.Log());