I want to show a message window displaying a string value, but I don't know how to write it. I have this code:
for (BufferedImage bImage : lineImage1) {
int trafficSection[] = analysis.colorShare(screenCapturing.getMapTrafficOnly(), bImage);
String trafficString = trafficSection[0] + " - " + trafficSection[1] + " - " + trafficSection[2] + " - " + trafficSection[3];
JOptionPane.showMessageDialog(this, trafficString, JOptionPane.INFORMATION_MESSAGE);
}
but it doesn't work. Can anybody help me please how to write a code for the message window?
Thanks
Here is the error:
java: no suitable method found for showMessageDialog(<anonymous cege.controller.ScreenCaptureController.ScreenCaptureListener>,java.lang.String,java.lang.String,int)
method javax.swing.JOptionPane.showMessageDialog(java.awt.Component,java.lang.Object,java.lang.String,int,javax.swing.Icon) is not applicable
(actual and formal argument lists differ in length)
method javax.swing.JOptionPane.showMessageDialog(java.awt.Component,java.lang.Object,java.lang.String,int) is not applicable
(actual argument <anonymous cege.controller.ScreenCaptureController.ScreenCaptureListener> cannot be converted to java.awt.Component by method invocation conversion)
method javax.swing.JOptionPane.showMessageDialog(java.awt.Component,java.lang.Object) is not applicable
(actual and formal argument lists differ in length)
I solved it. I just put the name of the class before this.