Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how can i show the joptionPane to show the message on button click
i JFrame class which have a jcomboBox and a button
on the button click the other class i.e Connect class is been called
now what i want that a message shoud appear for some error occured
but it is giving error


// The method showMessageDialog(Component, Object, String, int) in the type JOptionPane is not applicable for the arguments (String, String, String, int)



which component and object should i pass, i have component in the JFrame class i.e jcomboBox but i dont have any component and object in Connect class


please help me
Posted
Comments
Richard MacCutchan 23-May-13 3:25am    
Without seeing your actual code it is difficult to see what you are doing wrong. However, at a guess your call to showMessageDialog has some invalid arguments in the parameter list.

To simply put it, when you press the button( as i have understood ) you want to do something like this:
Java
JOptionPane.showMessageDialog(yourFrame,"This is the error message that you want to display");


Here is the link from docs.oracle.com for better information about JOptionPane:
http://docs.oracle.com/javase/7/docs/api/javax/swing/JOptionPane.html[^]

You have the possibility as well to choose what kind of message you want to display(Error Message, Information Message etc.), it's all in the link above.

Best regards.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900