【发布时间】:2014-01-31 20:28:38
【问题描述】:
我想显示一个显示字符串值的消息窗口,但我不知道如何编写它。我有这个代码:
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);
}
但它不起作用。谁能帮我写一个消息窗口的代码?
谢谢
这是错误:
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)
我解决了。我只是把班级的名字放在前面。
【问题讨论】:
-
您遇到错误了吗?怎么说它“不起作用”?
-
如何它不起作用?会爆炸吗?
标签: java swing joptionpane