任何人都知道为什么会出现错误“无法从菜单类型中对非静态方法 FileMenu() 进行静态引用”?
import javax.swing.JOptionPane;
public class Menu {
public void FileMenu() {
}
public void ViewMenu() {
}
public static void main(String[] args) {
String[] mainbuttons = { "File", "View" };
int choice = JOptionPane.showOptionDialog(null, "Please Select An Option: ","Application Menu",JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null,mainbuttons, mainbuttons[2]);
switch (choice) {
case 0:
FileMenu();
break;
case 1:
ViewMenu();
break;
}
}
}