בעיה בתפריט שאני בונה ב java
import java.awt.*; import java.awt.event.*; public class MenuFrame extends Frame { public MenuFrame() { super("Menu test"); MenuBar mb=new MenuBar(); Menu game=new Menu("game"); game.add(new MenuItem("play")); game.add(new MenuItem("exit")); mb.add(game); setMenuBar(mb); setSize(200,200); } public void actionPerformed(ActionEvent ev) { String arg=ev.getActionCommand(); if (arg.equals("exit")) public void windowClosing(WindowsEvent ev) { System.exit(0); } } public static void main(String[] args) { MenuFrame f=new MenuFrame(); f.show(); } }
בעיה אם תנאי ה if ה זה:public void windowClosing(WindowsEvent ev) { System.exit(0); }
אני עובד עם קומפיילר netbeans,אם זה יצביע על הבעיה ויעזור בהבנתה.