+ 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() ; ;

23rd Nov 2016, 5:04 AM
Kabis Nastou Condée
Kabis Nastou Condée - avatar
2 Réponses
0
double semicolons on the last line?? RedColor.add(RedColor) - a mistake?? you are adding the object RedColor to itself??
23rd Nov 2016, 5:32 AM
Rill Chritty
Rill Chritty - avatar
0
On another issue, you may want to call setVisible(true); so the window actually appears visible.
23rd Nov 2016, 9:09 AM
Andrew Michel
Andrew Michel - avatar