+ 1
Who would like to fond out for a single error in this code (JAVA) with GUI part
Import java.awt.*; import javax.swing.* ; class MyWindow extends JFrame { private JMenuBar barreMenus ; private JMenu Color, Dimensions ; private JMenuItem RedColor,GreenColor; private JMenuItem Height,Larger ; public MyWindow () { super("Window with a menu") ; setSize(300, 200) ; barreMenus = new JMenuBar() ; setJMenuBar(barreMenus) ; Color = new JMenu("Color") ; barreMenus.add(Color) ; RedColor = new JMenuItem("RedColor") ; RedColor.add(RedColor) ; RedColor.addSeparator() ; ;
2 Réponses
0
double semicolons on the last line??
RedColor.add(RedColor) - a mistake?? you are adding the object RedColor to itself??
0
On another issue, you may want to call setVisible(true); so the window actually appears visible.