JOptionPaneの静的メソッドを使用して、入力ダイアログを作成しようとしています。
public static Object showInputDialog(Component parentComponent,
Object message,
String title,
int messageType,
Icon icon,
Object[] selectionValues,
Object initialSelectionValue)
throws HeadlessException
私のコードは次のとおりです。
String username = JOptionPane.showInputDialog(null,
"Username",
"Pick a name",
JOptionPane.PLAIN_MESSAGE,
null,
null,
"default_name");
これは私にエラーをもたらします:
ChatController.java:49: incompatible types
found : java.lang.Object
required: java.lang.String
私が見逃している単純なものがあるに違いありません...