| |

VerySource

 Forgot password?
 Register
Search
View: 773|Reply: 2

An error occurred in showMessageDialog, saying that the parameter type is not applicable.

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-3-15 23:30:01
| Show all posts |Read mode
confirmButton.setBounds (new Rectangle (115, 215, 65, 25));
confirmButton.setText ("Confirm");
confirmButton.addActionListener (new ActionListener () {

public void actionPerformed (ActionEvent arg0) {
// TODO automatically generates method stubs
String cardId = "";
String passwordtemp = "";
String computerId = "";
cardId = cardIdTextField.getText (). trim ();
for (int i = 0; i <passwordFiled.getPassword (). length; i ++) {
passwordtemp + = passwordFiled.getPassword () [i];
}
computerId = computerIdCombox.getSelectedItem (). toString ();
if (computerId == null || computerId.trim (). length () == 0) {
JOptionPane.showMessageDialog (this, "Please select the machine number!", "Warning",
JOptionPane.WARNING_MESSAGE, null);
return;
}
if (cardId == null || cardId.length () == 0) {
JOptionPane.showMessageDialog (this, "Please enter the card number!", "Warning",
JOptionPane.WARNING_MESSAGE, null);
return;
}
if (passwordtemp == null || passwordtemp.length () == 0) {
JOptionPane.showMessageDialog (this, "Please enter a password!", "Warning",
JOptionPane.WARNING_MESSAGE, null);
return;
}
String dispalyNowTime = dispalyNowTimeTextField.getText () + ": 00";
WelcomePanel welcomePanel2 = new WelcomePanel ();
mainFrame.remove (mainFrame.getContentPane ());
mainFrame.getContentPane (). add (welcomePanel2);
mainFrame.setContentPane (welcomePanel2);
mainFrame.setVisible (true);
}}); It is an error at showMessageDialog, saying that the parameter type is not applicable.
Reply

Use magic Report

0

Threads

73

Posts

46.00

Credits

Newbie

Rank: 1

Credits
46.00

 Invalid IP Address

Post time: 2020-6-15 11:15:01
| Show all posts
>>JOptionPane.showMessageDialog(this, "Please select the machine number!", "Warning", JOptionPane.WARNING_MESSAGE, null);

You are using it in an inner class. Should this "this" be decorated with the class name of the outer class? For example: OutterClass.this.
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-6-17 06:15:01
| Show all posts
Um, Dawu! Thank you
I'll ask you more in the future
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list